I am just trying to get the contents of a StackPanel in a ResourceDictionary. I tried wrapping it in a data template, but did not go. Any other template? Style?
How can I extract this to a resource and then use the content in the layout of the view?
Cheers,
Berryl
xaml to move
<StackPanel x:Name="_filterByTypeOptions" Orientation="Horizontal" Margin="5, 5" >
<RadioButton Style="{StaticResource FilterPanelRadioButtonStyle}"
IsChecked="{Binding ShowAllContacts, Mode=TwoWay}"
Content="{resx:Resx Filter_ByType_ShowAll}" ToolTip="{Resx Filter_ByType_ShowAll_ToolTip}"
/>
</StackPanel>
UPDATE
current template
<DataTemplate x:Key="FilterTypeByTemplateControl">
<StackPanel x:Name="_filterByTypeOptions" Orientation="Horizontal" Margin="5, 5" >
<RadioButton Style="{StaticResource FilterPanelRadioButtonStyle}"
IsChecked="{Binding ShowAllContacts, Mode=TwoWay}"
Content="{resx:Resx Filter_ByType_ShowAll}" ToolTip="{Resx Filter_ByType_ShowAll_ToolTip}"
/>
/// etc.
</StackPanel>
</DataTemplate>
used in another stackpanel view
<StackPanel x:Name="_filterByNameOptions" DockPanel.Dock="Left" Orientation="Horizontal" Margin="5, 5" >
<ContentPresenter Content="{StaticResource FilterTypeByTemplateControl}"/>
</StackPanel>

, finally!
It works
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource FilterTypeByTemplateControl}"/>

source
share