Disable ComboBox Hyperlinks
-
Overview I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks. Problem I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this. [Here is a screenshot of the grid](https://1drv.ms/u/s!AjBmoYAYz\_v2hAxYsAuT5HGVloZ3?e=FCfEIx) and here's the XAML
If it's not broken, fix
-
Overview I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks. Problem I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this. [Here is a screenshot of the grid](https://1drv.ms/u/s!AjBmoYAYz\_v2hAxYsAuT5HGVloZ3?e=FCfEIx) and here's the XAML
If it's not broken, fix
What's wrong with binding the
IsEnabled
property on theHyperlink
to a property on your view-model?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
What's wrong with binding the
IsEnabled
property on theHyperlink
to a property on your view-model?
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
It would need to be bound to a property on the entity - except there is no entity. I'm loading the combo box with enums.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Overview I have a DataGrid with a DataGridTemplateColumn with a combobox inside it. The combobox is populated by enums using an ObjectDataProvider. The ComboBox DataTemplate renders the enum items hyperlinks. Problem I want to disable hyperlinks that should not be clickable based on some value on the entity. I'm not sure how to go about this. [Here is a screenshot of the grid](https://1drv.ms/u/s!AjBmoYAYz\_v2hAxYsAuT5HGVloZ3?e=FCfEIx) and here's the XAML
If it's not broken, fix
Use a
DataTemplateSelector
as theComboBox.ItemTemplateSelector
. TheSelectTemplate()
method will be passed each item, (theenum
in your case). Select a data template specific to each case you want."Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed." - G.K. Chesterton