Hard to Distinguish Current Tab using Default Color/Theme in a 2-Tab (Sibling) ChildTemplateView in 2009Q3Beta

14 posts, 0 answers
  1. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 19 Oct 2009 Link to this post

    I just installed Telerik Q3 2009 WinForms BETA (2009.2.9.1016) over 2009Q2 (2009.2.9.729) and in ChildTemplateViews where there are only 2 Tabs, it's now confusing which one is the Current Tab.  In Q2, the Current Tab header had a Background Color different from all the Column Headers which wasn't ideal but at least it matched the Current Row's Background Color*.  In Q3, not only does it not match Current Row's Background Color, it's in a dark gray color that makes it look like it's disabled especially compared to the bright gray Background Color of the Inactive Tabs and all the Column Headers, so it looks like the Current Tab is the one that has the same Background Color as the Column Headers.  In fact, I've seen Tab implementations where that is exactly how the Current Tab is highlighted (using the same Background Color as the Column Headers while the Inactive Tabs all have a different Background Color).  I don't even know if I can specifically change the Background Color of Active / Inactive Tab Headers vs. other Grid elements, but this is at least a poor choice of default color scheme.

    and the only RadGridView change mentioned was combined Vertical Scroll Bar for Grids with ChildTemplateView's.  

    Telerik 2009Q3 Beta (2009.2.9.1016), VS 2005 (v8.0.50727.762 SP.050727-7600), XP SP3 on Core2Duo 2.99GHZ with 3GB.

    * This should probably belong in a separate post, but speaking of making Current elements match the Current Row's Background Colors, I'd like to highlight the entire Current ChildTemplateView even if it's not Tabbed (i.e. has no siblings) by changing the Background Color of its entire Border to either some specified color or at least same as Current Row's Background Color and maybe even lowlight the Inactive Parent / Sibling's Borders and maybe Column Headers also in a different color.
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 22 Oct 2009 Link to this post

    Hi Tom,

    We decided to change the default RadGridView theme for our Q3 release to be more consistent with the other Telerik controls. Now it is Office 2007 Blue. The old theme is Vista. Yes, this is definitely a breaking change and we will announce it in our Q3 release notes. We appreciate your feedback and I will speak with our designers about the colors. You can switch to the old theme by dropping a VistaTheme component on your form and setting RadGridView.ThemeName  property to Vista. I have updated your Telerik points.

    Regarding your second question: You can use ViewCellFormatting event and you have to set its BackColor property to change the child view border color. Here is a sample:

    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement is GridDetailViewCellElement)
        {
            e.CellElement.BackColor = Color.Yellow;
            GridTableElement tableElement = ((GridDetailViewCellElement)e.CellElement).ChildTableElement;
            //...
        }
    }

    The tableElement is needed when you want to change some additional element of the child view. However, the preferred approach is to use Visual Style Builder and modify the existing theme.

    If you have any other questions, don't hesitate to contact me.

    Regards,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 22 Oct 2009 Link to this post

    1.1.       Thanks for the explanation and Release Notes update.  I would’ve marked it as the answer but the “Mark as answer” option isn’t working for me.  I’ve posted it under “Community Forums: Forum suggestions”

     

    2. 2.       I dragged a “VistaTheme” control onto my Form and entered “Vista” for the “ThemeName” Property as  you prescribed and the results were horrible!

     

    a.       Not only were the new horizontal grid lines gone, but even the old vertical ones disappeared also.

    b.      The Grouped by Columns Row and the MasterGridViewTemplate’s Column Headers, Column Filters and Data Rows all had the same Background Color (beige) as the rest of the Form.

    c.       The Column Headers were no longer in Bold.

    d.      The ChildGridViewTemplates’ disappeared (not indiscernible due to same color, gone).

    e.      Much less pad space around the text of Tabs Headers of the ChildGridViewTemplates’

    f.        Instead of bolded “+” and “-“ signs in front of Parent Rows of ChildGridViewTemplates, there’s now what appears to be vertical and horizontal grid lines simulating the appearance of “+” and “-“ signs and they take up the whole height and width of the Cells that used to contain the “+” and “-“ signs.

    g.       There’s now a vertical rectangle around each of the Apply Filter (Funnel) Buttons in the Column Filters Row.

    h.      The check inside CheckBoxes are now the same as the Foreground color as other Cells on the same Row vs. Green.  This is probably a good thing.

     

    Note that my ThemeClassName is set to “Telerik.WinControls.UI.RadGridView” (as it was when using Q2 also).  Also, when I dragged “VistaTheme” control onto my Form, it defaulted the name of that instance to “VistaTheme1”.  Should I be referencing that name anywhere?

     

    3.     3. Your code snipped does change the ChildGridViewTemplates’ Data Rows' and (if I add setting of the “tableElement.BackColor”) Border's Background Colors.  However, it does that regardless of whether they contain the CurrentRow.  I’m wanting a ChildGridViewTemplate’s Border Color changed only when it contains the CurrentRow (kind of like highlighting the CurrentTemplate in addition to the CurrentRow).  I imagine  I’ll probably need to handle the CurrentRowChanging Event to restore normal color to the old CurrentRow’s GridViewTemplate’s (if not the Master) Border Color and then change the new CurrentRow’s GridViewTemplate’s (if not the Master) Border Color to the highlight color.  Beyond that, I’m at a loss.  Also, I may want to change the Column Headers Row's Background Color also (since the MasterGridViewTemplate has no Borders).


  5. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 22 Oct 2009 Link to this post

    Correction to 2.c in my previous post: Should say "The ChildGridViewTemplates’ Borders disappeared (not just indiscernible due to being the same color as surrounding u.i. elements, just gone, vanished).".

    There should be #'s 1-3 in front of the 3 sections of my previous post.  I pasted them from Word and they disappeared, but I re-added them after pasting.  It was acting weird, like there was a section hidden just past the left edge of the posting window.
  6. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 28 Oct 2009 Link to this post

    Hi Tom Chien,

    Thank you for getting back to us.

    I have tested RadGridView with the default theme in Q2 2009 SP1 and with Vista theme in Q3 2009 beta. I did not find any differences in the look and feel. Please, send me some screenshots that demonstrates the described issue.

    You should not reference the default instance name of VistaTheme component anywhere. It is enough to drop it in your form and afterward choose the Vista theme from the drop down list for the ThemeName property.

    As to your question about changing the ChildView when you change the current row, you have to check if it contains the current row and apply the changes only upon this condition. Also, to apply the change immediately after changing the current row, you have to call GridElement.Update method. Please, consider the following code:

    void radGridView1_CurrentRowChanged(object sender, CurrentRowChangedEventArgs e)
    {
        this.radGridView1.GridElement.Update(GridUINotifyAction.StateChanged);
    }
     
    void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
    {
        if (e.CellElement is GridDetailViewCellElement)
        {
            if (this.radGridView1.CurrentRow != null && this.radGridView1.CurrentRow.ViewInfo == ((GridDetailViewCellElement)e.CellElement).ChildTableElement.ViewInfo)
            {
                e.CellElement.BackColor = Color.Yellow;
                GridTableElement tableElement = ((GridDetailViewCellElement)e.CellElement).ChildTableElement;
                //.....
            }
            else
            {
                e.CellElement.BackColor = Color.White;
                GridTableElement tableElement = ((GridDetailViewCellElement)e.CellElement).ChildTableElement;
                //.....
            }
        }
    }

    Regards,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 29 Oct 2009 Link to this post

    2. See attached screenshot JPEG's for 2099 Q2 and Q3 Beta .

    3. Thanks!  Works pretty good!  Couple of nitpick issues: a. How do I highlight MasterGridViewTemplate when the CurrentRow is in there (currently it only highlights ChildGridViewTemplate's)? b. When I change ChildGridViewTemplate's via Right-Click, it doesn't un-highlight the previous ChildGridViewTemplate.  I also noticed that when I change ChildGridViewTemplate's via Right-Click, it highlights one Cell vs. the whole Row.  This part of the thread has really blossomed and deserves to in its own thread.  Do you have an easy way to copy posts to another thread?
  8. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 04 Nov 2009 Link to this post

    Hi Tom Chien,

    Thank you for the screenshots. It seems that there is no applied theme to your RadGridView. That is why it looks so weird. Please, check carefully, how you are applying the grid theme in your source, and also if you have all needed references to Telerik theme assemblies.

    You cannot highlight a GridViewTemplate since it has no visual representation in the element structure. Please, note that actually we are changing the back color of ChildCellElement in the proposed code to indicate where is the current row. However, maybe it will be suitable for your scenario if you change the color of RowHeaderCells. You can do that by adding the following code in ViewCellFormatting event:

    void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
    {
        if (e.CellElement is GridRowHeaderCellElement && e.CellElement.ViewTemplate == this.radGridView1.MasterGridViewTemplate)
        {
            if(this.radGridView1.CurrentRow != null && this.radGridView1.CurrentRow.ViewInfo == ((GridTableElement)this.radGridView1.GridElement).ViewInfo)
            {
                e.CellElement.BackColor = Color.Yellow;
            }
            else
            {
                e.CellElement.BackColor = Color.White;
            }
        }
    }
     
    As to your second question, it seems that if you use right click, CurrentRowChanged event does not fire, and the grid is not updated. This is a bug and we will investigate it further. Currently, you can work-around this if you put the Update method in ContextMenuOpening event as well:

    void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
    {
        this.radGridView1.GridElement.Update(GridUINotifyAction.StateChanged);
    }

    The best way to separate different questions is to create different topics for them. Also, this will help us to provide you with faster and more accurate support.

    All the best,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 04 Nov 2009 Link to this post

    2. Thanks.  You suspicion was correct.  I didn't have Telerik.WinControls.Themes.Vista.DLL in my Project References.  Shouldn't it throw an compiler / run-time error in those cases?

    3. a. I tried your code, but it's not changing any colors when the CurrentRow is in the the MasterGridViewTemplate.  I can trace it going into the "e.CellElement.BackColor = Color.Yellow" Statement, but no colors are visibly changed.  I noticed that "e.CellElement"'s Name & Text Properties are both = "" and "ctype(e.CellElement, Telerik.WinControls.UI.GridRowHeaderCellElement).ColumnInfo.HeaderText = Nothing" in these cases.

    3.b. Thanks, adding the Update Method Call to the ContextMenuOpening Event fixed it not un-highlighting the previous GridView when changing GridViews via Right-Click.

  10. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 10 Nov 2009 Link to this post

    Hello Tom Chien,

    Please, find a small example project that demonstrates the suggested approach as an attachment to this message. Write me back if you have any other questions.

    Sincerely yours,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  11. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 10 Nov 2009 Link to this post

    Looks like it's VS2005.  Could you please reattach as VS2005?  Thanks.
  12. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 16 Nov 2009 Link to this post

    Hi Tom Chien,

    Please find attached to my message the sample project built with Visual Studio 2005.

    All the best,

    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  13. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 20 Nov 2009 Link to this post

    3.a.1. In both my VB app and your C# app, it does not work for at least the Vista Theme but does work for at least the Default and Telerik Themes.

    3.a.2. I couldn't get the other Themes to work at all (regardless of highlight).  It looked like it does when I don't have the applicable Theme DLL in my Project References at all.  At first, I couldn't get the Vista Theme to work at all in your C# app until I noticed it was referencing my installed copy of Q2 2009 (2009.2.9.729) the Vista Theme DLL (Telerik.WinControls.Themes.Vista.dll).  I had to Remove and add the Q3 2009 version for it to work at all.  FYI, the version of Telerik WinForms Controls in my VS 2005 Toolbox is still showing Q2 2009 (2009.2.9.729) even though I have Q3 2009 (2009.3.9.1103) installed.  http://www.telerik.com/community/forums/winforms/general-discussions/toolbox-controls-not-updated-when-install-2009q3-beta-or-final.aspx

  14. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 25 Nov 2009 Link to this post

    Hi Tom Chien,

    The demonstrated approach in the sample project is only an example and it does not work with the Vista theme because these themes use different DrawFill and NumberOfCollor settings for the cell element. To make the example work for the Vista theme, just add the following code everywhere where cell BackColor has been set to yellow:

    e.CellElement.DrawFill = true;
    e.CellElement.NumberOfColors = 1;
    e.CellElement.BackColor = Color.Yellow;

    As to the question about the toolbox version mishmash, I think that Robert gave you a right directions in the quoted forum link. Let me know if you need any additional help on this.

    Greetings,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  15. Tom Chien
    Tom Chien avatar
    125 posts
    Member since:
    Jun 2009

    Posted 25 Nov 2009 Link to this post

    3.a.1. Thanks, that made the MasterGridViewTemplate Row Header highlighting work for the Vista Theme.

Back to Top
UI for WinForms is Visual Studio 2017 Ready