3

私は次のモデルを持っています:

public class Model : INotifyPropertyChanged 
{
  public ObservableCollection<ViewElement> Elements { get; set; }

  public ViewElement CurrentElement { get; set; }
}

そして、親DataContextが上記のモデルである次のグリッド:

<dg:XamDataGrid DataSource="{Binding Path=Elements}" />

CurrentElement次のように、プロパティをグリッドの選択した項目にバインドしListViewます。

    <ListView x:Name="playbackSteps"
          ItemsSource="{Binding Path=Elements}"
          SelectedItem="{Binding Path=CurrentElement}" />

これをどのように提案しますか?

4

1 に答える 1

4

Infragistics フォーラムで述べられているように、XamDataGrid は IsSynchronizedWithCurrentItem プロパティを公開します。これを利用するには、ObservableCollectionのListCollectionViewが必要です。このようなもの:

public ListCollectionView ElementsView {get;set;}

// In the constructor:
this.ElementsView = new ListCollectionView(Elements);

次に、XamDataGrid を ElementsView にバインドします。

于 2009-04-24T14:44:55.567 に答える