Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1235
Synchronize Field With in Layout. Scrolling causes Size changed event.
posted

Hey Guys,

I am using a XamDataGrid and i am trying to Sync mein Field with, which works perfectly as i want it to.

To Sync my Field With I listen to the Size Change Event from the LabelPresenter

private void EventSetter_OnHandler(object sender, SizeChangedEventArgs e)
{
var lp = sender as LabelPresenter;
if (lp != null)
{
if (lp.Parent is VirtualizingDataRecordCellPanel && e.PreviousSize.Width != 0)
{
var layout = (lp.Parent as VirtualizingDataRecordCellPanel).DataContext as FieldLayout;
foreach (var field in layout.Fields)
{
if (field.Name.Contains("Result"))
{
field.Width = new FieldLength(lp.Field.CellWidthResolved);
}
}
}
}
}

The Problem is when i scroll the Grid Horizontally the Size Changed event occurs. Actually i understand why this is happening but how can i handle this problem so my Labels wont change their size when scrolling?

Markus