windows phone 7 - Get instance of AppBar Button -
in xaml have 2 different appbarr
s in resources:
<phone:phoneapplicationpage.resources> <shell:applicationbar x:key="appbar1" isvisible="true"> <shell:applicationbariconbutton x:name="abmain1" iconuri="/icons/appbar.radeos.png" text="radeos" click="abmain_click" /> </shell:applicationbar> <shell:applicationbar x:key="appbar2" isvisible="true"> <shell:applicationbariconbutton x:name="abmain" iconuri="/icons/appbar.radeos.png" text="radeos" click="abmain_click" /> <shell:applicationbariconbutton x:name="ablast" iconuri="/icons/appbar.back.rest.png" text="last" click="ablast_click" /> <shell:applicationbariconbutton x:name="abnext" iconuri="/icons/appbar.next.rest.png" text="next" click="abnext_click" /> <shell:applicationbariconbutton x:name="abclosepopup" iconuri="/icons/appbar.cancel.rest.png" text="close" click="abclosepopup_click" /> </shell:applicationbar> </phone:phoneapplicationpage.resources>
and switch in code, when need using:
applicationbar = (microsoft.phone.shell.applicationbar) resources["appbar1"];
or
applicationbar = (microsoft.phone.shell.applicationbar) resources["appbar2"];
question is: how instance of appbarr buttons (ex. abmain1
) in place in code?
visual studio see field, null
(because in resources).
you should able access so
applicationbariconbutton abmain1button = (applicationbariconbutton) applicationbar.buttons[0];
Comments
Post a Comment