c# - WP8 change background image when button clicked -
when button clicked, want alter background image in mainpage. in xaml have ; style="{staticresource layoutgridstyle}for background. how can accomplish ? !
it can done this:
public static class frameworkelementextensions { public static object tryfindresource(this frameworkelement element, object resourcekey) { var currentelement = element; while (currentelement != null) { var resource = currentelement.resources[resourcekey]; if (resource != null) { homecoming resource; } currentelement = currentelement.parent frameworkelement; } homecoming application.current.resources[resourcekey]; } } private void pagetitle_tap(object sender, system.windows.input.gestureeventargs e) { applicationtitle.style = (style)applicationtitle.tryfindresource("phonetexttitle1style"); } sample given here
c# xaml windows-phone-8 background-image
No comments:
Post a Comment