BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Hello again,
I realized that the complexe properties are not in cause. I forgot to mention I use a SfDataPager.
When I try to resize the column on the first page it won't work but when I move to a second page it work. And all along after that.
May be it will help you to find out why it has this behavior.
Thanks.
I'm still facing the issue, I'm using nuget packages for my solution following this list :
Package | Version |
Syncfusion.Data.WPF | 15.1460.0.41 |
Syncfusion.SfBusyIndicator.WPF | 15.1460.0.41 |
Syncfusion.SfGrid.WPF | 15.1460.0.41 |
Syncfusion.SfInput.Wpf | 15.2460.0.40 |
Syncfusion.SfShared.Wpf | 15.2460.0.40 |
Syncfusion.Shared.Wpf | 15.1460.0.41 |
My Essential Studio version is : 13.4.0.53
On your video you move datapager first, but like I said : the behavior occures before moving pager. After selected an other page (just after loading) I can resize columns but if I do not change pages I can not resize columns. Looks like the ActualWidth property does not update.
Regarding the code, I'm not using AutoGeneratedColumn.
I'm using a SfDataGridHelper class (on my own), with LoadGridAsync method wich load columns manualy adding GridColumn objects whose follows (for complex objects) this construct :
var col = new GridTemplateColumn
{
MappingName = colName,
HeaderText = headerText,
CellTemplate = cTmp,
EditTemplate = eTmp,
ColumnSizer = GridLengthUnitType.Auto,
AllowResizing = true
};
What is in CellTemplate and EditTemplate are DataTemplate, for example :
var txtBlck = new FrameworkElementFactory(typeof(TextBlock));
txtBlck.SetBinding(TextBlock.TextProperty, new Binding(colName));
txtBlck.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);
var elmtFct = new FrameworkElementFactory(typeof(ComboBox));
(lst is an List<object>)
elmtFct.SetValue(ItemsControl.ItemsSourceProperty, lst);
elmtFct.SetBinding(Selector.SelectedValueProperty, new Binding(propertyName));
var cellTemplate = new DataTemplate { VisualTree = txtBlck };
var editTemplate = new DataTemplate { VisualTree = elmtFct };
var col = new GridTemplateColumn
{
MappingName = colName,
HeaderText = headerText,
CellTemplate = cellTemplate,
EditTemplate = editTemplate,
ColumnSizer = GridLengthUnitType.Auto,
AllowResizing = true
};
columns.Add(col);
(columns is bind to my viewmodel and type with Columns in Syncfusion.SfGrid.WPF assembly).
Binding are like this in xaml :
<syncfusion:SfDataGrid Grid.Row="0" x:Name="MDataGrid" ItemsSource="{Binding ElementName=DataPager, Path=PagedSource}"
Columns="{Binding GridViewModel.Columns, Mode=TwoWay}">
</syncfusion:SfDataGrid>
<syncfusion:SfDataPager Grid.Row="1" x:Name="DataPager"
DataContext="{Binding GridViewModel}"
PageSize="35"
IsEnabled="{Binding EnablePager}"
Source="{Binding Items}" >
</syncfusion:SfDataPager>
Items is an ObservableCollection<object>.
May be these details will help you to understand the issue.
Do not hesitate to ask me more details. I don't share my sources because they are private and is a little bit more heavy. I tried to specify the most important things.
Hope that is clearer with these details. Meanwhile,
Have a nice day,
Regards, Alexandre Leclerc.
Hello Again Syncfusion,
I have noticed columns can be resized when I resized the window. In other words, when the grid get redraw, the columns width update properly.
So, I tried to call Refresh, InvalidateVisual, UpdateLayout and rerender the view with Dispatcher, without any good results.
May be that can help you to find something.
Hello Syncfusion, I found out why this behavior occurs.
It seem's columns needs to be add before items for the refresh UI. I think the visual needs content of columns to calculate width.
So, when I'm adding columns first then items secondly I can resize columns without any issues.
Thanks for your support. Have a nice day.
Hello Syncfusion, I found out why this behavior occurs.
It seem's columns needs to be add before items for the refresh UI. I think the visual needs content of columns to calculate width.
So, when I'm adding columns first then items secondly I can resize columns without any issues.
Thanks for your support. Have a nice day.