誰かがこのような作業を手伝ってくれますか?私は、リソーステンプレートを持っており、それにWPFをControlTemplateに渡すパラメータ
<ControlTemplate x:Key="PlanAssetValue" TargetType="ContentControl">
<ContentControl Template="{StaticResource Period}">
<StackPanel Height="Auto" Width="Auto" x:Name="MainPanel">
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Height="Auto"
Margin="10">
<TextBlock Text="{Binding Path=Paramprompt[IsMarket]}" DockPanel.Dock="Left" Width="160" Margin="0,2,0,0"/>
<ComboBox DockPanel.Dock="Left" Margin="5,0,0,0" Width="Auto"
ItemsSource="{Binding Path=ParamDetails[IsMarket]}"
DisplayMemberPath="Name"
VerticalAlignment="Top"
StaysOpenOnEdit="True"
SelectedValue="{Binding Path=ParamValues[IsMarket]}" SelectedValuePath="Code">
</ComboBox>
</DockPanel>
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Height="Auto"
Margin="10">
<TextBlock Text="{Binding Path=Paramprompt[Currency]}" DockPanel.Dock="Left" Width="160" Margin="0,2,0,0"/>
<ComboBox DockPanel.Dock="Left" Margin="5,0,0,0" Width="Auto"
ItemsSource="{Binding Path=ParamDetails[Currency]}"
DisplayMemberPath="Name"
VerticalAlignment="Top"
StaysOpenOnEdit="True"
SelectedValue="{Binding Path=ParamValues[Currency]}" SelectedValuePath="Code">
</ComboBox>
</DockPanel>
</StackPanel>
</ContentControl>
</ControlTemplate>
を重複コードの量を減少しようとしている私は、フィールドの代わりに設定したパラメータをテンプレートとして、いくつかのテキストを宣言したいIsMarket
<ControlTemplate x:Key="ParamCombobox" TargetType="ContentControl">
<DockPanel
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Height="Auto"
Margin="10">
<TextBlock Text="{Binding Path=Paramprompt[IsMarket]}" DockPanel.Dock="Left" Width="160" Margin="0,2,0,0"/>
<ComboBox DockPanel.Dock="Left" Margin="5,0,0,0" Width="Auto"
ItemsSource="{Binding Path=ParamDetails[IsMarket]}"
DisplayMemberPath="Name"
VerticalAlignment="Top"
StaysOpenOnEdit="True"
SelectedValue="{Binding Path=ParamValues[IsMarket]}" SelectedValuePath="Code">
</ComboBox>
</DockPanel>
</ControlTemplate>