Styling buttons from codebehind
Posted: 08 May 2014, 00:13
I am trying to apply style to a radio button from code behind. The style is defind in xaml as follows,
Codebehind is :
It gives me weird linking errors although I am not missing anything as such. Can you please suggest?
Code: Select all
<Style x:Key="RadioButtonStyle2" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Code: Select all
Noesis::Gui::RadioButton* plugin_button = new Noesis::Gui::RadioButton();
Ptr<IResourceKey> key = ResourceKeyString::Create("RadioButtonStyle2");
Noesis::Gui::Style* style = main_root->FindResource<Noesis::Gui::Style>(key.GetPtr());
plugin_button->SetStyle(s);