Home Forums WPF controls Xceed DataGrid for WPF How do I right align column headings?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #25457 |

    I have columns that display numeric data and I want the corresponding column headers to be right aligned. Is there a way to do this using a DataTemplate?

    Breeze

    Imported from legacy forums. Posted by Steve (had 2968 views)

    User (Old forums)
    Member
    Post count: 23064

    You have to do it yourself by overriding column manager cell template of that column.

    Imported from legacy forums. Posted by nat (had 430 views)

    Xceed Support
    Member
    Post count: 5658

    You can create an implicit style targeting ColumnManagerCell that sets its HorizontalContentAlignment property to Right.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 229 views)

    User (Old forums)
    Member
    Post count: 23064

    For those of you who might need to do this too, here is some sample code:

    <!– Style used for columns that are numeric –>
    <Style TargetType=”{x:Type xcdg:ColumnManagerCell}”>
    <Style.Triggers>
    <DataTrigger Binding=”{Binding RelativeSource={RelativeSource Self}, Path=FieldName}”
    Value=”MarkPrice”>
    <Setter Property=”HorizontalContentAlignment” Value=”Right”/>
    </DataTrigger>
    <DataTrigger Binding=”{Binding RelativeSource={RelativeSource Self}, Path=FieldName}”
    Value=”AskPrice”>
    <Setter Property=”HorizontalContentAlignment” Value=”Right”/>
    </DataTrigger>
    <DataTrigger Binding=”{Binding RelativeSource={RelativeSource Self}, Path=FieldName}”
    Value=”BidPrice”>
    <Setter Property=”HorizontalContentAlignment” Value=”Right”/>
    </DataTrigger>
    </Style.Triggers>
    </Style>

    Imported from legacy forums. Posted by Steve (had 4664 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.