I would like to know if it's possible to bind a DataView to a Windows.Controls.ListView

I have a DataView created from a DataTable and i would like to display the records on a ListView as there's no more DataGridView on WPF.

Would like to set this up programmatically through VB,

I have seen some example about it but i just can't replicate them for my usage.

I found that the XAML binding is like that,

<TextBox Text=¡±{Binding Source=¡¯some object¡¯ Path=¡¯some property name on the object¡¯}¡±>

However i don't understand how to create a Binding this way, to a DataView, whether through Orcas, or Expression Blend.

What i did is,

ListView0.ItemsSource = dv

With that, it seems row a filled but always with "System.Data.DataRowView" ...

The original data source is in XML but I am using a DataView because i need to create some views of some columns, especially with Distinct values.

The only thing i found so far is, i think i have to use CollectionViewSource but i just don't understand !

Could you please provide an explanation and eventually a sample code on how to set this up

Thanks a lot.

Re: Windows Presentation Foundation (WPF) Bind data to a ListView


Rather simple but not easy to guess !

Where DT is the table containing your data,

Put on your VB code :

Dim adp As New DataSet("test")

Dim dt As New DataTable


View0.DataContext = adp

On the XAML :

<ListView HorizontalAlignment="Right" x:Name="View0" Width="183" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Table1}">



<GridViewColumn Header="GridViewColumn" DisplayMemberBinding="{Binding Path=Artist}"/>

<GridViewColumn Header="GridViewColumnz" DisplayMemberBinding="{Binding Path=Title}"/>




And voila, you have your ListView binded to a data source !