Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Setting Default Style for Column

Sort Posts: Previous Next
  •  06-18-2008, 3:44 AM Post no. 13043

    Setting Default Style for Column

    Hi All,

    What I want is to apply a template to modify the way title is displayed for columns as follows;

    <!-- Data Template for Xceed Column-->
    <DataTemplate x:Key="colTemplate">
     
    <Label Content="{xcdg:CellEditorBinding}" TextBlock.FontWeight="Bold" />
    </DataTemplate>

    If I use this template explicitly with each column as follows;

     <xcdg:Column FieldName="AnyThing" TitleTemplate="{StaticResource colTemplate}" />

    it works fine. But this way I have to specify this TitleTemplate for each and every column in the grid.

    If I try to write a element targetted style for Column as;

    <Style TargetType="{x:Type xcdg:Column}">
        
    <Setter Property="TitleTemplate" Value="{StaticResource colTemplate}" />
    </Style>

    it does not work. I've tried to put this style in Window.Resources, Grid.Resources and even in DataGridControl.Resources but of no use.

    Any help is highly appreciated.

    Thanks in advance


    Abdullah Ansari
    Senior Software Engineer
    Outworks Solutions Private Limited

    Everything is okay in the end. If its not okay, then its not the end.
    Filed under: ,
  •  06-29-2008, 12:04 PM Post no. 13292 in reply to 13043

    Re: Setting Default Style for Column

    No takers of this yet???
    Abdullah Ansari
    Senior Software Engineer
    Outworks Solutions Private Limited

    Everything is okay in the end. If its not okay, then its not the end.
  •  07-02-2008, 4:44 AM Post no. 13364 in reply to 13292

    Re: Setting Default Style for Column

    Hi Abdullah,

    I, too, spent a long time on this, then referred back to the help file. In the help file table of contents under Basic Concepts > Object Model Overview > Column Class article there is a section "Appearance". It states:

    All elements in a grid, with the exception of columns, can be stylized in the same way as elements provided by the Microsoft .NET Framework.

    I'm just suffering and putting it in every column.

    David

  •  07-02-2008, 2:23 PM Post no. 13384 in reply to 13364

    Re: Setting Default Style for Column

    I will forward your request to the developers however, it is possible that it is something we will not be able to change...
    Mathieu Drimonakos
    -Technical Designer-
  •  07-22-2008, 11:52 AM Post no. 13680 in reply to 13043

    Re: Setting Default Style for Column

    I am able to achieve this by modifying the ColumnManagerCell style to include a new Setter as follows:

     <Setter Property="FontWeight" Value="Bold" />

     this sets all the Cells font in the the Column Manager Row to bold

  •  07-24-2008, 1:47 AM Post no. 13720 in reply to 13680

    Re: Setting Default Style for Column

    I also struggled a bit with this.

    It seems the best way to change the template of the column title row, is to define a new control template for the ColumnManagerCell class.

    Just make sure to include a thumb with the name: PART_ColumnResizerThumb in the control template definition for the column resize to work.

    Here is a sample:

    <Style TargetType="{x:Type xcdg:ColumnManagerCell}">

    <Setter Property="Template">

    <Setter.Value>

    <ControlTemplate TargetType="{x:Type xcdg:ColumnManagerCell}">

    <Grid>

     

    <Button>

    <Button.Content>

    <ContentPresenter TextBlock.Foreground="Blue"></ContentPresenter>

    </Button.Content>

     

    </Button>

    <Thumb Width= "1" Name="PART_ColumnResizerThumb" HorizontalAlignment="Right"></Thumb>

     

     

    </Grid>

    </ControlTemplate>

    </Setter.Value>

    </Setter>

    </Style>

    This defnition could be done inside the theme as well.

    The TitleTemplate property of the Column class, takes a datatemplate and there seems to be no direct way to change the control template through a property. It would be good if the control developers provide a property for setting the control template as they have provided for setting a data template.

    It would be good if Xceed publishes few samples on how the control template of the various elements in the grid view could be changed. (Atleast I was not able to find one)

    I am evaluating Xceed grid for one of our projects and using it for the first time. Let me know if I am missing something.

     

     

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.