User conditional Formating and Theme

8 posts, 2 answers
  1. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 03 Dec 2010 Link to this post

    Hi

    How to apply the défault application theme to the "Conditional Formating" windows who is displayed for end users ?

    (In my application, I use the Dersert Theme, so when this windows is showed, the blue color is not welcome.)

    Thanks

    Anthony
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 04 Dec 2010 Link to this post

    Helo Anthony,

    This will happen automatically if you set the application theme name for the entire application.
    ThemeResolutionService.ApplicationThemeName = "Desert"

    (See screenshot)

    Hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Answer
    Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 04 Dec 2010 Link to this post

    Hello guys,

    Or if you are using different themes in your application and just want to show the ConditionalFormattingForm with a different theme, you can just do the following:

    var conditionalFormattingForm = new ConditionalFormattingForm(this.radGridView1.MasterTemplate, null);
    conditionalFormattingForm.ThemeName = "Desert";
    conditionalFormattingForm.Owner = this.FindForm();
    conditionalFormattingForm.Show();
     
    And to use this from the grids's ContextMenu, you can just use the following:
    //register for the context menu opening event
    radGridView1.ContextMenuOpening += new ContextMenuOpeningEventHandler(radGridView1_ContextMenuOpening);
      
    void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
    {
        var conditionalFormattingItem =
            e.ContextMenu.Items.Where(i => i.Text.Contains("Conditional")).FirstOrDefault();
        if (conditionalFormattingItem == null)
        {
            return;
        }
      
        var index = e.ContextMenu.Items.IndexOf(conditionalFormattingItem);
        e.ContextMenu.Items.RemoveAt(index);
        conditionalFormattingItem = new RadMenuItem(conditionalFormattingItem.Text);
        e.ContextMenu.Items.Insert(index, conditionalFormattingItem);
      
        conditionalFormattingItem.Click += this.conditionalFormattingItem_Click;
    }
     
    void conditionalFormattingItem_Click(object sender, EventArgs e)
    {
        var conditionalFormattingForm = new ConditionalFormattingForm(this.radGridView1.MasterTemplate, null);
        conditionalFormattingForm.ThemeName = "Desert";
        conditionalFormattingForm.Owner = this.FindForm();
        conditionalFormattingForm.Show();
    }

    Hope this helps, if you have any other questions or comments, please let me know,

    Best Regards,
    Emanuel Varga

    Telerik WinForms MVP
  5. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 04 Dec 2010 Link to this post

    Thanks all !

    Perfect !
  6. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 08 Dec 2010 Link to this post

    Hi again, me again...

    What's about system dialog box ?

    I need to open an savedialogbox. If I wan't a to apply a theme on it I need to rewrite it ?

  7. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 Dec 2010 Link to this post

    Hello,

    the Windows Save Dialog box is still a windows form control and therefore you would have to look at implementing your own as this cannot be styled as far as Im aware.
    Richard
  8. Filleau
    Filleau avatar
    114 posts
    Member since:
    Jun 2006

    Posted 08 Dec 2010 Link to this post

    Thanks.
    But I can imagine that it must be already exist a code to do that.... somewhere.
  9. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 Dec 2010 Link to this post

    Hi Again,

    Have a look at the Telerik response in this forum post

    hope that helps
    Richard
Back to Top
UI for WinForms is Visual Studio 2017 Ready