Reputation: 43
I am looking for the proper WPF control(s) to display a list of strings subject to the following constraints:
Maybe a ListBox or a ListView. Despite spending many hours searching for documentation and examples I am not sure yet if and how to make the list items editable. I am a novice... sigh
Thank you in advance.
Upvotes: 0
Views: 734
Reputation: 11
You can use DataGrid which is an editable Gridview.
You should create a class to bind DataGrid like as shown
public class MyItem
{
public string Item { get; set; } = stirng.empty;
}
Then create control in XAML
<DataGrid x:Name="dgList" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Databases" Binding="{Binding Value}" />
</DataGrid.Columns>
</DataGrid>`
Then you can write binding
string aa = "aa,xx,cc,vv,bbb,hh,gg,rr,tt,yy,uu,ooo";// add your list from DB
dgList.ItemsSource = aa.Split(',').Select(x => new MyItem() { Item = x });
Upvotes: 1