Home Forums WPF controls Xceed DataGrid for WPF Styling GroupHeaderControl

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

    I am creating The DataGrid in Runtime
    not in XAML Code

    AS following:

    // Create DataGrid
    myGrid = new MyDataGridControl();
    myGrid.SelectionMode = SelectionMode.Single;
    myGrid.Width = 710;
    myGrid.Height = 325;
    TableView view = new TableView();
    view.Theme = new AeroNormalColorTheme();
    view.Headers.Add(new DataTemplate(typeof(MyInsertion)));
    ((Grid)this.Content).Children.Add(myGrid);

    And it’s working

    But Now i faced a problem

    I am trying To Style The GroupHeaderControl in RunTime ( I can’t style it in XAML as in other posts on this forum )
    But i don’t Know HOW!!!

    Thx in advance.

    Imported from legacy forums. Posted by hesham (had 4104 views)

    Xceed Support
    Member
    Post count: 5658

    <code>
    Style myNewStyle = new Style( typeof(GroupHeaderControl) );

    //Do whatever you need with the style and then

    ((Grid)this.Content).Resources.Add(myNewStyle);

    </code>

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

    User (Old forums)
    Member
    Post count: 23064

    Thx Marcus for ur help
    but it doesn’t seem to work with me ( nothing changed in the GroupHeaderControl)
    is there something wrong with this code :??

    LinearGradientBrush brush = new LinearGradientBrush();
    brush.GradientStops.Add(new GradientStop(Color.FromRgb(0, 0, 0), 0.12));
    brush.GradientStops.Add(new GradientStop(Color.FromRgb(114, 143, 255), 1));
    Style myNewStyle = new Style(typeof(GroupHeaderControl));
    myNewStyle.Setters.Add(new Setter(GroupHeaderControl.BackgroundProperty,
    brush));
    ((Grid)this.Content).Resources.Add(myNewStyle,””); // Take two parameters :S

    Thx

    Imported from legacy forums. Posted by hesham (had 367 views)

    Xceed Support
    Member
    Post count: 5658

    Hmmm, I guess I should have looked at the SDK documentation a little better!! :$

    the line to set the Implicit Style is in fact this one:

    ((Grid)this.Content).Resources.Add(typeof(GroupHeaderControl), myNewStyle);

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

    User (Old forums)
    Member
    Post count: 23064

    Mmm it didn’t work too :S:S

    i guess the problem now is to set GroupHeaderControl to use this style

    but how can i catch the control to set its style

    // I am getting the datatemplate of the control not the control itself
    DataTemplate temp=myGrid.View.FixedHeaders[0];

    // how can i catch the groupbyheader control to set the style
    ……… .Style=this.Resources[“mynewstyle”];

    i knew i asked too much 😀 but thx for your help

    Imported from legacy forums. Posted by hesham (had 484 views)

    Xceed Support
    Member
    Post count: 5658

    Just to make sure, are you referring to the control that is used to expand/collapse and show information about groups or you are referring to the control that is used to drag/drop column headers in order to group them.

    If it’s the second option, then we were simply mistaken on the control name since it is called the GroupByControl (GroupHeaderControl refers to the control that is the “header” of each group when grouped).

    Let me know if this was indeed the problem.

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

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