windows store apps - How to change VisualState Setter property via code in C#? -
i have following visualstate setter properties in uwp app.
<visualstatemanager.visualstategroups> <visualstategroup x:name="visualstategroup"> <visualstate x:name="desktop"> <visualstate.statetriggers> <adaptivetrigger minwindowwidth="800" /> </visualstate.statetriggers> <visualstate.setters> <setter target="desktopads.visibility" value="visible" /> <setter target="desktopads.(grid.row)" value="0" /> <setter target="desktopads.(grid.column)" value="4" /> <setter target="desktopads.(grid.columnspan)" value="1" /> <setter target="mainscrollviewer.(grid.row)" value="0" /> <setter target="mainscrollviewer.(grid.column)" value="2" /> <setter target="mediacontrol.height" value="600" /> <setter target="mobileads.visibility" value="collapsed" /> <setter target="mainscrollviewer.(grid.columnspan)" value="1" /> </visualstate.setters> </visualstate> <visualstate x:name="phone"> <visualstate.statetriggers> <adaptivetrigger minwindowwidth="0" /> </visualstate.statetriggers> <visualstate.setters> <setter target="desktopads.visibility" value="collapsed" /> <setter target="mediacontrol.height" value="400" /> <setter target="desktopads.(grid.row)" value="1" /> <setter target="desktopads.(grid.column)" value="0" /> <setter target="desktopads.(grid.columnspan)" value="3" /> <setter target="mobileads.visibility" value="visible" /> <setter target="mainscrollviewer.(grid.row)" value="0" /> <setter target="mainscrollviewer.(grid.column)" value="0" /> <setter target="mainscrollviewer.(grid.columnspan)" value="5" /> </visualstate.setters> </visualstate> </visualstategroup> </visualstatemanager.visualstategroups>
i want have trial , paid version of app trial version having ads , paid version without ads. using licenseinformation.istrial property determine whether app trial or paid version , when app loading making visibility of desktopads , mobileads collapsed. because of adaptivetriggers desktopads , mobileads visibility gets changed visible , still see ads. how make visibility permanently collapsed in paid version of app?
what want use visual state groups. this:
<visualstatemanager.visualstategroups> <visualstategroup x:name="layoutvisualstategroup"> <visualstate x:name="desktop" /> <visualstate x:name="phone" /> </visualstategroup> <visualstategroup x:name="advertvisualstategroup"> <visualstate x:name="showads" /> <visualstate x:name="hideads" /> </visualstategroup> </visualstatemanager.visualstategroups>
then, let adaptive triggers handle layout, , let code-behind handle hiding , showing adverts. because put states groups, mutually exclusive, , can set indep. sort of how button can both pressed
, enabled
. groups. typical approach, way.
best of luck!
Comments
Post a Comment