Home Forums WPF controls Xceed DataGrid for WPF Horizontal Alignment of Headers

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

    I have version 2.0 of the Datagrid and am trying to centre the text in the header. I have set the HorizontalContentAlignment of the ColumnManagerRow to “Center” but it has no effect. I am using the ClassicSystemColorTheme theme. Please help.

    My xaml definition of the grid:
    <xcdg:DataGridControl x:Name=”dgrdDetail”
    ItemsSource=”{Binding Source={StaticResource SalesForecast}}”
    Grid.ColumnSpan=”8″
    Grid.Row=”9″
    PreviewKeyDown=”dgrdDetail_PreviewKeyDown”
    InitializingInsertionRow=”dgrdDetail_InitializingInsertionRow”
    IsKeyboardFocusWithinChanged=”dgrdDetail_IsKeyboardFocusWithinChanged”
    SelectionMode=”Single”
    CellEditorDisplayConditions=”CellIsCurrent”
    ValidationMode=”CellEndingEdit”
    >

    <xcdg:DataGridControl.View>
    <xcdg:TableView UseDefaultHeadersFooters=”False” ShowRowSelectorPane=”False”>
    <xcdg:TableView.Theme>
    <xcdg:ClassicSystemColorTheme />
    </xcdg:TableView.Theme>
    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters />
    <DataTemplate>
    <xcdg:ColumnManagerRow FontWeight=”Bold” HorizontalAlignment=”Center” HorizontalContentAlignment=”Center” VerticalContentAlignment=”Bottom” AllowColumnReorder=”False” AllowSort=”True” AllowDrop=”False” />
    </DataTemplate>
    <DataTemplate>
    <xcdg:InsertionRow />
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>

    <xcdg:TableView.FixedFooters >
    <DataTemplate>
    <StackPanel>
    <xcdg:StatRow>
    <xcdg:StatCell FieldName=”Comments” HorizontalContentAlignment=”Right”>
    <Bold>
    Totals:
    </Bold>
    </xcdg:StatCell>
    <xcdg:StatCell FieldName=”AdexTV” Content=”{Binding Source={StaticResource Totals}, Path=TotAdexTV, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”AdexRadio” Content=”{Binding Source={StaticResource Totals}, Path=TotAdexRadio, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”AdexUs” Content=”{Binding Source={StaticResource Totals}, Path=Totdmg, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Minimal” Content=”{Binding Source={StaticResource Totals}, Path=TotTen, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Even” Content=”{Binding Source={StaticResource Totals}, Path=TotFifty, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Strong” Content=”{Binding Source={StaticResource Totals}, Path=TotEighty, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Booked” Content=”{Binding Source={StaticResource Totals}, Path=TotBooked, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Lost” Content=”{Binding Source={StaticResource Totals}, Path=TotLost, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    </xcdg:StatRow>
    <xcdg:StatRow>
    <xcdg:StatCell FieldName=”Comments” HorizontalContentAlignment=”Right”>
    <Bold>
    % Totals:
    </Bold>
    </xcdg:StatCell>
    <xcdg:StatCell FieldName=”Minimal” Content=”{Binding Source={StaticResource Totals}, Path=PerTotTen, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Even” Content=”{Binding Source={StaticResource Totals}, Path=PerTotFifty, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Strong” Content=”{Binding Source={StaticResource Totals}, Path=PerTotEighty, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    <xcdg:StatCell FieldName=”Booked” Content=”{Binding Source={StaticResource Totals}, Path=TotBooked, Converter={StaticResource currencyConverter}, ConverterParameter=c0 }” />
    </xcdg:StatRow>
    </StackPanel>
    </DataTemplate>
    </xcdg:TableView.FixedFooters>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>

    <xcdg:DataGridControl.Columns>
    <xcdg:Column FieldName=”ForecastId” Visible=”False” />
    <xcdg:Column FieldName=”ForecastType” Title=”Client Status” >
    <xcdg:Column.CellEditor>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <xcdg:NavigableComboBox SelectedItem=”{xcdg:CellEditorBinding}”
    ItemsSource=”{Binding Source={StaticResource ForecastTypes}}”>
    </xcdg:NavigableComboBox>
    </DataTemplate>

    Imported from legacy forums. Posted by Lance (had 4112 views)

    Xceed Support
    Member
    Post count: 5658

    You were almost right on track!

    What you need to do is apply the HorizontalContentAlignment to the ColumnManagerCell instead of the ColumnManagerRow…

    This can be done by applying an implicit style on ColumnManagerCell:

    <Style TargetType=”xcdg:ColumnManagerCell”>
    <Setter Property=”HorizontalContentAlignment”
    Value=”Center” />
    </Style>

    Imported from legacy forums. Posted by Marcus [Xceed] (had 344 views)

    User (Old forums)
    Member
    Post count: 23064

    I tried this and it doesn’t work.

    Imported from legacy forums. Posted by Lance (had 665 views)

    Xceed Support
    Member
    Post count: 5658

    I can now confirm this doesn’t work with the Classic theme.

    I have filed a bug report for this issue.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 663 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve fixed the issue in the template of the ColumnManagerCell, the fix will be available in the next service release. Thank you for reporting it !

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

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