1

オブジェクトの (TaxonDescription) リストにバインドされている単純な ListView があります。

別の TaxonDescription を選択すると、ListView の要素は更新されません。

NotifyPropertyChangedのどこかが必要かもしれませんが、どこでも試しました。

私のクラスがあります。

ページの分離コードで ItemSource を確認すると、適切なリスト要素があり、ビューに更新されていません。

<ListView ItemsSource="{Binding Descriptions}" 
          SelectedItem="{Binding ActualSelectedDescription, Mode=TwoWay}">
    <ListView.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding DescriptionName}"></TextBlock>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>


// this not updated
<ListView ItemsSource="{Binding ActualSelectedDescription.Images}"> 
    <ListView.ItemTemplate>
        <DataTemplate>
            <Image Source="{Binding NormalUri}" />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

<TextBlock Text="{Binding ActualSelectedDescription.Name}"/> //This is works well

ActualSelectedDescription はイベントによって変更されます。

public TaxonDescription ActualSelectedDescription
        {
            get{return actualSelectedDescription;}
            set { actualSelectedDescription = value;
                  RaisePropertyChanged("ActualSelectedDescription"); } 
            //In the setter the Images are in the list
        }

そして、画像リストにリスト要素があります

リストを持つ Description クラスがあります。

class TaxonDescription
    {
        public List<BaseImage> Images { get; private set; }
                    public  string Name { get; private set; } 

        public TaxonDescription(string taxonName, string descriptionName)
        {
            Name = taxonName;
            Images = new List<BaseImage>();
            //Adding some element
        }
    }

正確なアイデアは役に立ちます。すべて試してみます;)

4

1 に答える 1