- noesis_user
- Posts: 14
- Joined:
Styling buttons from codebehind
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);
-
sfernandez
Site Admin
- Posts: 3152
- Joined:
Re: Styling buttons from codebehind
Could you please attach the link warnings you are getting?
Under which platform are you building your project?
P.S. Just an advice, in your C++ code you can use Ptr smart pointer to take care of object references. You have to write: "Ptr<Noesis::Gui::RadioButton> plugin_button = *new Noesis::Gui::RadioButton();". Then you don't need to delete this object manually, it will be deleted automatically when no references to the object are kept.
Under which platform are you building your project?
P.S. Just an advice, in your C++ code you can use Ptr smart pointer to take care of object references. You have to write: "Ptr<Noesis::Gui::RadioButton> plugin_button = *new Noesis::Gui::RadioButton();". Then you don't need to delete this object manually, it will be deleted automatically when no references to the object are kept.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests