How to add button dynamically to datagrid in wpf?

I am trying to do something in WPF. I have a datagrid that I am bound to some values. I need that whenever I call this page a second time, I need to insert a button to all cells of all columns in the datagrid (with the exception of cells in the first column that are bound to some value). How can i do this? Please, help.

+1
source share
1 answer

You can add crumpled (hidden buttons that do not take up space) to the cells and make them visible if necessary.

This behavior can also be tied to some condition with an IValueConverter by visibility property.

UPDATE tx . , , :

  • .
 <Window.Resources>
    <BooleanToVisibilityConverter x:Key="myConverter"/>
  </Windos.Resources>
<Button   Visibility="{Binding Path=myCondtion,Converter={StaticResource myConverter}}"/>

myContition - , . , , , false, , .

+1

Source: https://habr.com/ru/post/1723212/


All Articles