As the title says, I want to hide or display some content dynamically. I have two buttons working like radio buttons. Each button has to display a specific content, but the two contents must not be visible at the same time (it's a kind of form, and I'm working on two subclasses).
I've seen on SO two interesting things, and I wanted to mix them. Firstly, the use of ContentControl with a ToggleButton (http://stackoverflow.com/questions/7698560/how-to-bind-click-of-a-button-to-change-the-content-of-a-panel-grid-using-xaml). Secondly, using ToggleButtons as RadioButtons (http://stackoverflow.com/questions/2362641/how-to-get-a-group-of-toggle-buttons-to-act-like-radio-buttons-in-wpf second answer with 31)
So I decided to start with something like that :
<ContentControl>
<ContentControl.Template>
<ControlTemplate>
<WrapPanel HorizontalAlignment="Center">
<TextBlock Text="{x:Static Internationalization:Resources.MAINOPTIONSWINDOW_STATUSLINKSUPERVISOR}"/>
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="Alarm" GroupName="Trigger"/>
<RadioButton Style="{StaticResource {x:Type ToggleButton}}" Content="Event" GroupName="Trigger"/>
</WrapPanel>
</ControlTemplate>
</ContentControl.Template>
</ContentControl>
But Visual Studio underlines
{StaticResource {x:Type ToggleButton}}
Visually, my buttons appear like radio buttons instead of toggle buttons. Visual says :
Impossible to resolve the resource "{StaticResource {x:Type ToggleButton}}" (translated from french ;) )
Anyway this code works fine outside the ContentControl.