简体   繁体   English

Wpf DatagridComboBoxCell

[英]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". 我通过搜索字词“ wpf datagrid combobox column”通过google在第一个结果中找到了XAML解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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