这是触发 PropertyChanged 的属性:
public override List<Tag> Tags
{
get
{
return base.Tags;
}
set
{
if (base.Tags != value) {
base.Tags = value;
if (PropertyChanged != null)
{
PropertyChanged(this,
new PropertyChangedEventArgs("Tags"));
PropertyChanged(this,
new PropertyChangedEventArgs("TotalTagPages"));
PropertyChanged(this,
new PropertyChangedEventArgs("PageHasTags"));
}
}
}
}
修改 CurrentPage.Tags 时,此控件会正确刷新:
<TextBlock DockPanel.Dock="Bottom" Name="TagHeader"
Text="{Binding CurrentPage.Tags,
Converter={converter:EnumerableToSpacedString}}"
Foreground="White" />
当 CurrentPage.Tags 更改时,此选项不会刷新,但在 CurrentPage 本身更改时会这样做:
<ListBox VerticalAlignment="Top"
Style="{StaticResource DarkListBox}"
ItemTemplate="{StaticResource TagTemplateNoCounts}"
ItemsSource="{Binding CurrentPage.Tags}" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
有任何想法吗?