How to add GridNumericColumn dynamic in code
Hello,
I add GridNumericColumn dynamic programmatically with this code:
foreach (var p in AvailablePayments)
{
column = new GridNumericColumn();
column.HeaderText = p.Name;
column.Width = 60;
column.TextAlignment = TextAlignment.Right;
Binding binding = new Binding($"[payments_{p.Id}][paid]");
column.ValueBinding = binding;
dgOrders.Columns.Insert(2, column);
}
But when I run it, these columns doesn't have the function of fliter.
Could you help me?
SIGN IN To post a reply.
5 Replies
VS
Vijayarasan Sivanandham
Syncfusion Team
August 6, 2021 05:34 AM UTC
Hi WANG RENJIE,
Thank you for contacting Syncfusion Support.
You can enable filtering for particular column by setting GridColumn.AllowFiltering property. Please refer the below code snippet,
Thank you for contacting Syncfusion Support.
You can enable filtering for particular column by setting GridColumn.AllowFiltering property. Please refer the below code snippet,
|
private void btn_Click(object sender, RoutedEventArgs e)
{
var column = new GridNumericColumn();
column.HeaderText = "Name";
column.Width = 60;
//enable filtering for particular column by setting AllowFiltering property
column.AllowFiltering = true;
column.TextAlignment = TextAlignment.Right;
Binding binding = new Binding("OrderID");
column.ValueBinding = binding;
sfDataGrid.Columns.Insert(2, column);
} |
For more information related to Filtering, please refer the below user guide documentation,
UG Link: https://help.syncfusion.com/wpf/datagrid/filtering#excel-like-ui-filtering
Please let us know if you have any concerns in this.
Regards,
Vijayarasan S
Hello,
I use the index not property name ,
could it filter?
Thanks.
VS
Vijayarasan Sivanandham
Syncfusion Team
August 6, 2021 10:11 AM UTC
Hi WANG RENJIE,
Thanks for the update.
Thanks for the update.
All the data operations (sorting, grouping, filtering and etc.) are supported when you are binding indexer property. If the data operations are not working as expected, set GridColumn.UseBindingValue as true to make it work.
|
foreach (var p in AvailablePayments)
{
column = new GridNumericColumn();
column.HeaderText = p.Name;
column.Width = 60;
column.TextAlignment = TextAlignment.Right;
//enable filtering for particular column by setting AllowFiltering property
column.AllowFiltering = true;
column.UseBindingValue = true;
Binding binding = new Binding($"[payments_{p.Id}][paid]");
column.ValueBinding = binding;
dgOrders.Columns.Insert(2, column);
}
|
For more information related to Binding Indexer properties, please refer the below user guide documentation,
UG Link: https://help.syncfusion.com/wpf/datagrid/data-binding#binding-indexer-properties
Please let us know if you have any concerns in this.
UG Link: https://help.syncfusion.com/wpf/datagrid/data-binding#binding-indexer-properties
Please let us know if you have any concerns in this.
Regards,
Vijayarasan S
VS
Vijayarasan Sivanandham
Syncfusion Team
August 6, 2021 11:00 AM UTC
Hi WANG RENJIE,
Thanks for the update.
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.
Regards,
Vijayarasan S
Thanks for the update.
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.
Regards,
Vijayarasan S
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
WR WANG RENJIE
- Aug 5, 2021 11:37 AM UTC
- Aug 6, 2021 11:00 AM UTC