Hi Joseph,
Thanks for contacting Syncfusion support.
We have checked your query. The bindable property can be created that detects the property changing in SfDataGrid.
|
Note: We have prepared a custom bindable property for SfDataGrid.AllowSorting.
|
Refer the below code for more details:
|
<sfgrid:SfDataGrid x:Name="dataGrid" AllowEditing="True"
ItemsSource="{Binding OrdersInfo}"
AutoGenerateColumns="False"
AllowSorting="{Binding CustomSort, Mode=TwoWay}"
ColumnSizer="Auto">
<sfgrid:SfDataGrid.Columns>
<sfgrid:GridNumericColumn MappingName="OrderID" HeaderText="Order ID"/>
<sfgrid:GridTextColumn MappingName="CustomerID" HeaderText="Customer ID"/>
<sfgrid:GridTextColumn MappingName="FirstName" HeaderText="First Name"/>
<sfgrid:GridTextColumn MappingName="LastName" HeaderText="Last Name"/>
<sfgrid:GridTextColumn MappingName="ShipCountry" HeaderText="Ship Country"/>
</sfgrid:SfDataGrid.Columns>
</sfgrid:SfDataGrid>
|
Viewmodel.cs
|
public static readonly BindableProperty CustomSortProperty = BindableProperty.Create("CustomSort", typeof(bool),
typeof(ViewModel),
false, BindingMode.TwoWay, propertyChanged: CustomSortPropertyChanged);
public bool CustomSort
{
get { return(bool) GetValue (CustomSortProperty); }
set { this.SetValue(CustomSortProperty,value); }
}
public static void CustomSortPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
//you can customize your requirement
}
|
We have prepared a sample based on your requirement and you can download the same from below link.
Regards,
Shivagurunathan. K