所以,我有一个ItemsControl绑定到ObservableCollection中的Items集合....作为DataTemplate的一部分,我有两个按钮,其中一个是将ItemsControl ItemsSource传递给一个多转换器....
这是问题....当我向CurrentTransaction.Items添加一个项目时,转换器,GetPriceMultiConverter,被调用就好了但是当我从CurrentTransaction.Items中删除一个项目时,GetPriceMultiConverter没有触发但是UI正在更新...
这是XAML
<ItemsControl x:Name="SalesScreen" ItemsSource="{Binding CurrentTransaction.Items}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button Width="225" Background="Transparent" Foreground="White" Margin=".5" Content="{Binding DisplayName}" Command="{Binding DataContext.RemoveSaleCommand, ElementName=Screen}" CommandParameter="{Binding}" />
<Button Width="90" Background="Transparent" Foreground="White" Margin=".5" Command="{Binding DataContext.RemoveSaleCommand, ElementName=Screen}" CommandParameter="{Binding}" >
<Button.Content>
<MultiBinding Converter="{StaticResource GetPriceMultiConverter}" >
<Binding ></Binding>
<Binding ElementName="SalesScreen" Path="ItemsSource" ></Binding>
</MultiBinding>
</Button.Content>
</Button>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
这是绑定属性
private Transaction _CurrentTransaction;
public Transaction CurrentTransaction
{
get { return _CurrentTransaction; }
set { _CurrentTransaction = value; OnPropertyChanged("CurrentTransaction"); }
}
有什么想法吗?