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
905
CellValuePresenterStyleSelector -- DataRecords Values = 2147483647
posted

I have a CellValueStyleSelector that seems to think that all the values for all the fields in my grid are 2147483647, when examined in the debugger. "Selected" is an IEnumerable<T>, and appears to populate correctly in the grid.

<igDP:XamDataGrid DataSource="{Binding Selected}" 
				  ActiveDataItem="{Binding ActiveSelectedRecord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
				  ScrollViewer.CanContentScroll="True" 
				  SelectedItemsChanged="SelectedGrid_OnSelectedItemsChanged" 
				  RecordFilterDropDownPopulating="Grid_OnRecordFilterDropDownPopulating">
	<igDP:XamDataGrid.FieldSettings>
		<igDP:FieldSettings AllowEdit="False" 
							AllowFixing="Near" 
							AllowRecordFiltering="True" 
							AllowGroupBy="True"
							CellClickAction="SelectRecord"
							CellValuePresenterStyleSelector="{StaticResource CVPStyleSelector}"
							GroupByRecordPresenterStyleSelector="{StaticResource FieldStyleSelector}"
							EditorStyleSelector="{StaticResource FieldStyleSelector}"/>
	</igDP:XamDataGrid.FieldSettings>
	<igDP:XamDataGrid.FieldLayoutSettings>
		<igDP:FieldLayoutSettings HighlightAlternateRecords="True"
								  SelectionTypeCell="None"  
								  AllowFieldMoving="WithinLogicalRow" 
								  FilterUIType="LabelIcons" 
								  AutoGenerateFields="False"
								  AllowDelete="False"/>
	</igDP:XamDataGrid.FieldLayoutSettings>
	<igDP:XamDataGrid.FieldLayouts>
		<igDP:FieldLayout>
			<igDP:Field Name="Id" Label="{Binding Path=Owner.DataPresenter.DataContext.IdLabel, RelativeSource={RelativeSource Self}}" Width="100"/>
			<igDP:Field Name="Description" Label="Description" Width="200" IsScrollTipField="True"/>
			<igDP:Field Name="ParentId" Label="{Binding Path=Owner.DataPresenter.DataContext.ParentIdLabel, RelativeSource={RelativeSource Self}}" Width="100"/>
			<igDP:Field Name="ParentDescription" Label="{Binding Path=Owner.DataPresenter.DataContext.ParentDescriptionLabel, RelativeSource={RelativeSource Self}}" Width="200"/>
		</igDP:FieldLayout>
	</igDP:XamDataGrid.FieldLayouts>
</igDP:XamDataGrid>
 
public override Style SelectStyle(object item, DependencyObject container)
{
	Style defaultStyle = Application.Current.FindResource("CellBackgroundStyle") as Style;

	try
	{
		CellValuePresenter fieldPresenter = container as CellValuePresenter;
		Field field = fieldPresenter?.Field;
		// All values for all fields are reporting as 2147483647
		_row = fieldPresenter?.Record;

		if (_row == null)
			return defaultStyle;

		Style style = GetCellValuePresenterStyle(defaultStyle, field);
		return style;
	}
	catch (System.Exception ex)
	{
		ExceptionHelper.LogError(Core.ExceptionManagement.LogLevel.Error, ex);
		return defaultStyle;
	}
}

Parents
No Data
Reply
  • 34830
    Verified Answer
    Offline posted

    Hello Danielle,

    The value that you are seeing appears to be for your "Id" field. The first time through the SelectStyle method for each visible CellValuePresenter appears to be happening before the data item is really initialized for the underlying record. The number that you are seeing is represented as the static int.MaxValue. I imagine if you looked at the other values for the cells in your Record, you would see other "default" placeholder values as well.

    I would imagine that after the first four times this event fires, the data item should then be initialized, and you should see the correct values inside the SelectStyle method. Is this assumption correct, or are you consistently seeing that your Id cell is int.MaxValue?

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

Children
No Data