This is a migrated thread and some comments may be shown as answers.

Grouped By column: dark text, dark background

13 Answers 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 27 Apr 2012, 04:42 PM
Hello,
I have a dataview with grouping turned on.  In my xaml for setting the columns on the gridview, some columns have a custom header and some do not.  the reason for the custom header is allow for text wrapping.

if the user groups by one of the columns with a custom header, the default format is black text on black background.  if the user groups by a column without a custom header, its shows up with white text on a black background.

how can i make the custom column headers show up white on black?  Please see attached imaged.

thanks,
Dan

13 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 30 Apr 2012, 12:50 PM
Hi Dan,

When a custom header is defined RadGridView would  a bitmap snapshot of the column header in order to avoid a Silverlight limitation of a visual element not being able to be a child of more than one parent.
I believe this is what causes the trouble. Can you please paste me the code for your custom column header. I will build a small repro project here and try find a workaround  for you.

All the best,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dan
Top achievements
Rank 1
answered on 30 Apr 2012, 01:20 PM
I appreciate your response.  here is my custom header.

<telerik:GridViewDataColumn UniqueName="AvailBOGTime"  DataMemberBinding="{Binding AvailBOGTime}"  HeaderCellStyle="{StaticResource GridViewHeaderCellStyleSmallFilter}">
    <telerik:GridViewDataColumn.Header>
        <TextBlock Text="Avail/BOG Year-Qtr" TextWrapping="Wrap" Width="50"/>
    </telerik:GridViewDataColumn.Header>
</telerik:GridViewDataColumn>
0
Accepted
Vanya Pavlova
Telerik team
answered on 01 May 2012, 11:32 AM
Hello Dan,

 

You may try to manually change the content in GridViewGroupPanelItem something like the following:

private void RadGridView1_Grouped(object sender, GridViewGroupedEventArgs e)
      {
          ColumnGroupDescriptor desc = e.GroupDescriptor as ColumnGroupDescriptor;
 
          this.Dispatcher.BeginInvoke(new Action(() => this.SetGroupItemContent(desc)));
      }
      private void SetGroupItemContent(ColumnGroupDescriptor desc)
      {
 
          foreach (var item in this.RadGridView1.ChildrenOfType<GridViewGroupPanelItem>())
 
              try
              {
                  TextBlock t = new TextBlock();
                  t.Text = "Avail/BOG Year-Qtr";
                  item.Content = t;
 
              }
              catch
              {
 
              }
 
      }
Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dan
Top achievements
Rank 1
answered on 01 May 2012, 03:04 PM
that worked, thanks!
0
WILLIAM
Top achievements
Rank 1
answered on 05 Feb 2013, 03:39 PM
I am having the same issue, but with a regular data column.  I'm not sure what constitutes a "Custom Column Header".  It's a column with dates as data and the header is a text block with "Last Activity".  We have multiple grids (a lot) and several fields where the text in the group by box is black on a dark grey background.  It will be a lot of work to do a looping for every grid, and every field, to catch the ones that don't show in white.  Can't I set a property somewhere to set the color of the text in the box?

Thanks for your help!
0
Vijay
Top achievements
Rank 1
answered on 08 Feb 2013, 08:49 PM
Hi i have the same issue i did everything you said it's working when i drag and drop the columns but i save those group descriptors and when i try to reload the grid i create ColumnGroupDescriptors programmatically  and apply to the grid  i am having the same issue of showing the text in the Black color  .

Thanks!
Vijay
0
Pavel Pavlov
Telerik team
answered on 11 Feb 2013, 08:42 AM
Hi guys,

Since there is not a direct property to manipulate the foreground I may suggest the following alternatives :

1. Incorporate the code suggested by Vanya into attached behavior and attach this behavior to the instance of RadGridView that require it .

or

2. Use the GroupPanelItemStyle property of RadGridView to set a different template for the group panel item.

or

3. I encourage you to open a support ticket with a project of yours that exposes the specific problem of yours. I will be glad to apply a fix in your project and get it back to you .

*Please mention this thread ID (538671)  in case you open a support ticket so I can address it personally.


Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
WILLIAM
Top achievements
Rank 1
answered on 18 Feb 2013, 07:45 PM
Thanks Pavel, I will try to implement one of those solutions.
0
WILLIAM
Top achievements
Rank 1
answered on 18 Feb 2013, 09:18 PM
Option 1 seems the best option for us since we have a lot of different grids.  However, the solution provided is still not 100% what we need.

the GridView.Grouped and GridView.Grouping events are only fired when the user does something to initiate, change, or remove grouped columns.  Our business case is we have grids where we are grouping columns in code when the view is shown.  When the grid is initially shown, the GroupPanel is visible and grouping has been applied, but neither of those events fired and the text is still black on a dark gray control. Is there an event (or can we get one) for when the GroupPanel is shown?  At this point we could then loop through and inspect its items.

Also, when do the PanelItems get created?  Even though I have GroupDescriptors, and they are visible in the Group Panel, radGridView.ChildrenOfType<GridViewGroupPanelItem>() returns 0 items.  Maybe an event to notify that the Items in the panel has changed.  ??

We really need to come up with a way to handle this in code.  We probably have between 65 and 85 different grids and it will not be feasible to alter the xaml of each grid independently.

Please help, our users are screaming about this.

Thanks!!
0
WILLIAM
Top achievements
Rank 1
answered on 19 Feb 2013, 02:00 PM
Would it possible to post the necessary code to find the control and set its properties in the GroupPanelItemStyle?  I need it for code behind, not xaml.

Thanks!
0
Pavel Pavlov
Telerik team
answered on 19 Feb 2013, 02:37 PM
Hi Dan ,
To be more specific and provide some  working code, I will really  need a runnable project of yours illustrating your particular setup. Please open a support ticket and attach the project to it.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
WILLIAM
Top achievements
Rank 1
answered on 29 Mar 2013, 06:13 PM
Good Afternoon,

I was checking up on this to see if this has been fixed or if there is a work around.  Our users are really wanting this fixed.  Can you post the code behind that will address this, so I that I can handle all of our grids in one place?

Thanks for your help!!
0
Dimitrina
Telerik team
answered on 03 Apr 2013, 02:26 PM
Hello,

May I ask you to send us a demo project showing your case, so that we can be more specific in our response? 

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Dan
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Dan
Top achievements
Rank 1
Vanya Pavlova
Telerik team
WILLIAM
Top achievements
Rank 1
Vijay
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or