hello
I 'm trying to handle resized column event when the user
resize it to save its new width on setting file
how can i do that I didn't find any event in XamDataGrid that respond to resize event
How do we detect if the user has changed column width?
regards
igor
Hello,
You can create a Style in the XamDataGrid’s Resources for the LabelPresenter and add an EventSetter for its SizeChanged event like this:
<Style TargetType="{x:Type igDP:LabelPresenter}"> <EventSetter Event="SizeChanged" Handler="LabelPresenter_SizeChanged"/> </Style>
Also your event handler in the code behind could look like this:
private void LabelPresenter_SizeChanged(object sender, SizeChangedEventArgs e) { }
Hope this helps you.
<Style TargetType="{x:Type Editors:ValueEditor}">
<EventSetter Event="SizeChanged" Handler="ValueEditor_SizeChanged"/>
</Style>
Just tried that based on this thread and it didn't work... What am I missing?
Hi all.
It is very disappointing that there is no ColumnResized event on the grid.
In my situation, I have a grid with a child record layout, that has to match the parent record layout for usability reasons. This grid is part of the accounting application where each parent row includes totals of the child rows. It is imperative that the column widths of the parent and child rows match exactly. Otherwise, the user will get confused.
Ideally, when a user resizes one of the parent row columns, I would like to resize the corresponding child row column so it always matches the parent row column and vice versa.
I tried to capture the events suggested earlier in this thread but they fire too often. I feel that handling the PropertyChanged event on the field will impact performance.
What is the best way to request this feature to be added to the grid?
Serge Matsevilo
HI,
You can wire up the Field's PropertyChanged Event.
then inside the event check out the e.propertyname field.
xamDataGrid1.FieldLayouts[0].Fields[0].PropertyChanged +=
new PropertyChangedEventHandler(MainWindow_PropertyChanged);
void MainWindow_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
//throw new NotImplementedException();
MessageBox.Show(e.PropertyName);
You will see LabelWithResolved and CellWidthRsolved names.
Down side is this might fire often.
Sincerely.
MattDeveloper Support Engineer