我只是想把StackPannel 内容输入资源词典中。 我尝试把它包成数据临时模板,但没有去。 另一种模板? 风格?
我怎样才能将它提取到资源中 然后使用我所看到的网格布局的内容?
Cheers,
Berryl
the 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}"
/>
// ... more of the same
</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 of the view
<StackPanel x:Name="_filterByNameOptions" DockPanel.Dock="Left" Orientation="Horizontal" Margin="5, 5" >
// ... more stuff
<ContentPresenter Content="{StaticResource FilterTypeByTemplateControl}"/>
</StackPanel>
""https://i.sstatic.net/8g1xP.jpg" alt="此处输入图像描述"/ >
finally!
这个作品
<ContentPresenter Content="{Binding}" ContentTemplate="{StaticResource FilterTypeByTemplateControl}"/>
""https://i.sstatic.net/fSK4g.jpg" alt="此处输入图像描述"/ >