0

在 Win 8 Release Preview 下运行的 WinRT 应用程序中的组合框有一个奇怪的问题。这是一个代码片段:

<ListView.ItemTemplate>
     <DataTemplate>
         <Grid>
              <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="*"/>
                  <ColumnDefinition Width="*"/>
              </Grid.ColumnDefinitions>
              <TextBox Grid.Column="0" Text="{Binding Name, Mode=TwoWay}" VerticalAlignment="Center"/>
              <ComboBox Grid.Column="1" ItemsSource="{Binding Source={StaticResource evtTypeRes}}" SelectedValuePath="ID" DisplayMemberPath="Name" SelectedValue="{Binding EventTypeID, Mode=TwoWay}" VerticalAlignment="Center"/>
          </Grid>
     </DataTemplate>
</ListView.ItemTemplate>

ListView 由 ObservableCollection 列表支持,并且项目实现 INotifyPropertyChanged。问题是,当我更改屏幕中组合框的值时,该值不仅会更改特定行,而且会更改每一行(属性的设置器会在集合中的每个对象上调用)。文本框不是这种情况。这种奇怪行为的原因可能是什么?

提前致谢

4

1 回答 1

0

我找到了IsSynchronizedWithCurrentItem属性的用途:值False解决了我的问题。

于 2012-07-09T12:42:41.207 回答