0
我有一個文本框和一個按鈕,該按鈕的ControlTemplate打開一個子窗體可選擇的東西,並顯示在文本框中選擇的項目,如:如何創建ControlTemplate的兩個獨立實例在窗口中?
<Window.Resources>
<ControlTemplate x:Key="CreateParam">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Button Content="select" Command="{Binding ShowSpecItemViewommand}" Grid.Column="0" Margin="2"/>
<TextBox Margin="2" Text="{Binding Param}" Grid.Row="0" Grid.Column="1"/>
<TextBlock Margin="5" Text="patameter" Grid.Row="0" Grid.Column="2"/>
</Grid>
</ControlTemplate>
</Window.Resources>
和我有這樣的視圖模型屬性:
public string param;
public string Param
{
get
{
return param;
}
set
{
param = value;
RaisePropertyChanged("Param");
}
}
,現在我想在一個窗口中創建一個控制的兩個獨立的實例,但是當我選擇的第一個實例的值,他們都已經changed.should我定義了兩個性能又如何呢?我可以將它們綁定到控件模板嗎? 我不確定每個人都能理解我的意思,所以我希望有人編輯我的問題:)