I have created a xamgrid programmatically and I am binding a dynamic dataTable to it. I would like to create a column with buttons in xamgrid programmatically.
Hello Ramesh,
In order to display a column that is not bound to any specific data and contains buttons, you may use the xamGrid Unbound Column.
I have attached a sample application that demonstrates its usage.
Thanks for your reply. In the sample provided, the button content remains the same for all buttons. How do I bind the button content for each of the buttons based on a certain cell value? Also is it possible to merge unbound(button) column based on row value?
You can see more about unbound columns binding here:
http://ko.infragistics.com/help/wpf/xamgrid-itemtemplate-binding
You can see more about unbound columns merging and sorting here:
http://ko.infragistics.com/help/wpf/xamgrid-merged-cells
http://ko.infragistics.com/help/wpf/xamgrid-sorting-unbound-columns
I’ve attached a sample application for your reference.
Hi,
I would also like to know if it is possible to display buttons only for certain rows in a unbound column and leave the others empty. For example, if the dynamically binded button content of the unbound column is empty, button shouldn't be added to the xamgrid unbound column.
You may control the visibility of the buttons for example by adding a new property of type Visibility in your data model and after that binding it to the Button Visibility property.
<DataTemplate x:Key="CustomButtonTemplate">
<Button Content="{Binding RowData.CategoryID}" Visibility="{Binding RowData.Visible}" />
</DataTemplate>
I’ve attached a modified sample demonstrating this.