我有一個簡單的ListBox.ItemTemplate
包含Label
和TextBox
綁定到CSLA Bindable List
。當我選擇TextBox
時,CurrentItem
不會更改,只有當我選擇Label
時纔會更改。我有IsSynchronizedWithCurrentItem='True'
。Wpf ItemTemplate CurrentItem
<ListBox x:Name="ItemsDataGrid"
ItemsSource="{Binding Source={StaticResource AuditItems},Path=Items}"
IsSynchronizedWithCurrentItem="True">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Content="{Binding Path=TypeRef}" />
<TextBox x:Name="TextBoxQty"
Grid.Column="1"
Text="{Binding Path=TaliQty}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
非常好,經過深思熟慮! – 2010-01-23 12:49:55