0
我有一個文本框內cellediting模板中的數據網格。我想將在文本框中輸入的文本 綁定到每個單元格的文本塊。我試過這個代碼,但它不會工作。如何檢索在數據網格中的texbox中輸入的文本
這是我的XAML:
<DataTemplate>
<StackPanel Orientation="Horizontal">
<!--<ComboBox x:Name="monday" Width="50" IsSynchronizedWithCurrentItem="true" Loaded="monday_Loaded" SelectionChanged="monday_SelectionChanged"></ComboBox>-->
<ComboBox x:Name="monday" Width="30" ItemsSource="{Binding Path=Subjects}" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" SelectedItem="{Binding SelectedCollectionItem,Mode=TwoWay}" Loaded="monday_Loaded" SelectionChanged="monday_SelectionChanged"></ComboBox>
<ComboBox x:Name="staff" Width="30" ItemsSource="{Binding Path=mondstaff}" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" SelectedItem="{Binding SelectedCollectionItem1,Mode=TwoWay}" Loaded="staff_Loaded" SelectionChanged="staff_SelectionChanged"></ComboBox>
<TextBox x:Name="monothers" Visibility="Hidden" Text="{Binding Path=Subjects}" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}}" SelectedText ="{Binding SelectedCollectionItem2,Mode=TwoWay}" Width="30" TextChanged="monothers_TextChanged"></TextBox>
<!--<ComboBox x:Name="staff" Width="50" Loaded="staff_Loaded"></ComboBox>-->
</StackPanel>
</DataTemplate>
這裏是我的代碼:
public string SelectedCollectionItem
{
get { return _SelectedCollectionItem; }
set
{
_SelectedCollectionItem = value;
RaiseProperty2("SelectedCollectionItem2");
}
}
如果有人知道如何做到這一點,請幫助我。
好的謝謝你的建議 – prabhakar