1

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>

何か案は?

4

1 に答える 1

2

それが機能しない理由はわかりません(リストを変更する必要がありますINotifyCollectionChanged)...

于 2012-08-24T16:38:01.753 に答える