In my XamDataGrid resources I was able to right-align the summaries with:
<Style TargetType="{x:Type igDP:SummaryResultPresenter}"> <Setter Property="HorizontalAlignment" Value="Right" /> </Style>
I need to right align cells as well - but I don't want to use a resource style because it will right-align everything. I only have a few fields that need to be right aligned. What would the XAML look like if I wanted to right-align on a field by field basis?
Thanks!
Hello,
If you want to right-align only specific field in you XamDataGrid you can add a style for the CellValuePresener in its Resource section with a x:Key as follows:
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}"
x:Key="RightAligned">
<Setter Property="HorizontalAlignment" Value="Right"/>
</Style>
</igDP:XamDataGrid.Resources>
After doing so, you can set this style for fields that you want by setting the CellValuePresenterStyle property of its FieldSettings like this:
<igDP:Field Name="name" Label="Name">
<igDP:Field.Settings>
<igDP:FieldSettings
CellValuePresenterStyle="{StaticResource RightAligned}"/>
</igDP:Field.Settings>
</igDP:Field>
By following this approach you right-align only the fields that have CellValuePresenterStyle set to the style above.
If you require any further assistance please do not hesitate to ask.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Krasimir,
Thanks for this answer. It helped me.
Thanks for the response - and that does work, however, I have some other styling and field settings on the field and I can't seem to get the right-alignment style on the cell value presenter working with what I already have on the field.
I already have this:
<igDP:Field Name="Test" Label="Test" Width="120"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type Editors:XamTextEditor}" > <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type Editors:XamTextEditor}"> <Setter Property="Format" Value="##%" /> <Setter Property="ValueType" Value="{x:Type System:Single}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
If I introduce the right-alignment xaml, it does not seem to work... when I introduce it by itself without what I currently have, it works fine.