I have a custom control that contains a XamDataGrid (v10.3). AutoGenerateColumns = false and fields are dynamically and added to a FieldLayout that is then assigned as the DefaultFieldLayout. All fields bind to numeric properties of business objects. I have tried the following to center the content in my grid's cells:
From code:
foreach (Field fld in myControl.myXamDataGrid.DefaultFieldLayout.Fields) { fld.Settings.CellValuePresenterStyle = new Style(typeof(CellValuePresenter)); fld.Settings.CellValuePresenterStyle.Setters.Add(new Setter(CellValuePresenter.HorizontalContentAlignmentProperty, HorizontalAlignment.Center)); }
From XAML (UserControl.Resources):
<Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center" /> </Style>
None of these approaches are working. Any ideas?
Thanks,
Paul
Hello Paul,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.