Category / Section
How to prevent resizing the last column in Silvelright?
2 mins read
When you resize the last column of parent grid towards left, the child grid columns go out of view in MasterDetails view of SfDataGrid as the width of the parent grid is lesser than the width of the child grid. Therefore, after resizing you cannot view the remaining child grid columns in view.
The following screenshot illustrates a four child Grid columns that is clipped due to resizing parent Grid in left wards.
Figure 1: Four child Grid columns clipped due to resizing parent Grid in left wards
To overcome this problem, disable the resizing support for the last column in parent grid and you can achieve this by setting DetailsViewManager.DisableLastColumnResizing attached property as true, as per the following code example.
XAML
<Window x:Class="DetailsViewSimple.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Local="clr-namespace:DetailsViewSimple" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"> <syncfusion:SfDataGrid x:Name="dataGrid" AllowResizingColumns="True" AllowResizingHiddenColumns="True" HideEmptyGridViewDefinition="True" syncfusion:DetailsViewManager.DisableLastColumnResizing="True" ItemsSource="{Binding Path=OrdersDetails}"> </syncfusion:SfDataGrid>