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
980
grid cell alignment
posted

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!

 

 

Parents
No Data
Reply
  • 30945
    Suggested Answer
    Offline posted

    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

     

Children