简体   繁体   中英

Wpf DatagridComboBoxCell

如何在Wpf中创建datagridComboBoxCell,以便运行时可以绑定该单元?

I guess u mean column not cell, don't you?

For a column you could use something like this:

<dg:DataGridComboBoxColumn Header="Current Category"

SelectedValueBinding="{Binding Path=CurrentCategory}"

  SelectedValuePath="CategoryID"

DisplayMemberPath="CategoryName"

ItemsSource="{Binding Source={StaticResource categoriesDataProvider}}">

If you want to change bindings at runtime u have to name your column and set the appropiate bindings in code.

I found the XAML solution in the first result via google with search term "wpf datagrid combobox column".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM