c# - Access the Setter property -
i have next usercontrol:
<usercontrol x:class="test.views.navigationmenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:rtuforwindows8.views" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="300" d:designwidth="400"> <usercontrol.resources> <style x:key="homeappbarbuttonstyle" targettype="buttonbase" basedon="{staticresource appbarbuttonstyle}"> <setter property="automationproperties.automationid" value="homeappbarbutton"/> <setter property="automationproperties.name" value="ewffgwefwfwefwefwe"/> <setter property="content" value=""/> </style> </usercontrol.resources> <stackpanel orientation="horizontal"> <button style="{staticresource homeappbarbuttonstyle}" /> <button style="{staticresource appbarbuttonstyle}" /> </stackpanel>
and in code want change the:
<setter property="automationproperties.name" value="ewffgwefwfwefwefwe"/>
value something, do:
navigationmenu nm = new navigationmenu(); var style = (nm.resources["homeappbarbuttonstyle"] style).setters[1];
and cant figure out how enter set value?
how should like:
the setters sealed. if cast them setter have access property value in place of setterbase runtime exception when try modify them.
i think can find solution want in topic : change style dynamically in wpf
Comments
Post a Comment