SfDataGrid column width AutoWithLastColumnFill to specific column
Thanks
George
Used a MultiBinding Converter and added the Window Width and the rest of the columns ActualWidth as parameters
<syncfusion:GridTextColumn.Width>
<MultiBinding Converter="{StaticResource AutoFillColumnWidthConverter}">
<Binding Path="Width" ElementName="Window" FallbackValue="0"/>
<Binding Path="ActualWidth" ElementName="Column1" FallbackValue="0"/>
<Binding Path="ActualWidth" ElementName="Column3" FallbackValue="0"/>
<Binding Path="ActualWidth" ElementName="Column4" FallbackValue="0"/>
<Binding Path="ActualWidth" ElementName="LastColumn" FallbackValue="0"/>
</MultiBinding>
</syncfusion:GridTextColumn.Width>
public class AutoFillColumnWidthConverter : IMultiValueConverter
{
public double WindowWidth { get; set; }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
WindowWidth = (double)values[0];
double DataGridWidth = 0;
List<object> list = values.ToList();
list.RemoveAt(0);
foreach (var value in list)
{
double width = System.Convert.ToDouble(value);
if (!double.IsNaN(width))
{
DataGridWidth += width;
}
}
return WindowWidth - DataGridWidth;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Hi George,
Thank you for using Syncfusion Products.
We have analyzed your query. We cannot achieve your requirement directly to adjust the specific column width like AutoWithLastColumnFill behavior for last column. Currently we are working on the sample to achieve your requirement by overriding the GridColumnSizer and we will let you know the status on or before September 30, 2015.
Please let us know if you have any query.
Thank you,
Jai Ganesh S
Hi George,
You can achieve your requirement to “Adjust the specific column width like AutoWithLastColumnFill behavior for last column” through work around. We have prepared the sample based on this and you can download the sample from the below location,
Sample: http://www.syncfusion.com/downloads/support/directtrac/144750/ze/SfGridDemo-346634687
In the above sample, we have adjusted the width for EmployeeArea column.
Please let us know if you have any other query.
Regards,
Jai Ganesh S
- 3 Replies
- 2 Participants
-
GS George Sterg
- Sep 25, 2015 04:41 PM UTC
- Oct 1, 2015 02:32 AM UTC