c# - have stackpanel clickable and load viewport -
first post here if wrong please slap me.
i'm trying learn uwp code , want try create bottom naivation bar. i'm trying work stackpanels so
the idea when stackpanel clicked / tapped should load new page viewport, can't figure out correct code so. here's short version of stackpanel:
<stackpanel orientation="horizontal" verticalalignment="bottom"> <stackpanel name="firstbutton" tapped="firstbutton_tapped"> <textblock x:name="icon1" /> <textblock x:name="text1" /> </stackpanel> <stackpanel name="secondbutton" tapped="secondbutton_tapped"> <textblock x:name="icon2" /> <textblock x:name="text2" /> </stackpanel> <stackpanel name="thirdbutton" tapped="thirdbutton_tapped"> <textblock x:name="icon3" /> <textblock x:name="text3" /> </stackpanel>
i chose stackpanel because best way me have bottom , horizontal aligned bar icon on top , text displaying under it. (if got better idea feel free post it)
now question how should write c# code tapped event load second page viewport.
(further, style i'm aiming similar deezer uses, example here: http://imgur.com/wnni96v
thank in advance!
as @pedro g. dias says far better use button
control has many more benefits (visual states) associate user clicking/ tapping button rather using tap
event of stackpanel
you can customise button
utilising contenttemplate
<stackpanel orientation="horizontal" verticalalignment="bottom"> <button x:name="firstbutton" click="firstbutton_click"> <button.contenttemplate> <datatemplate> <stackpanel> <textblock x:name="icon1" /> <textblock x:name="text1" /> </stackpanel> </datatemplate> </button.contenttemplate> </button> <!--more buttons here--> </stackpanel>
Comments
Post a Comment