Disable Theming of Controls in FilterCell

2 posts, 1 answers
  1. Dominik
    Dominik avatar
    14 posts
    Member since:
    Jan 2017

    Posted 13 Feb Link to this post

    Hi, 

     

    I have created a custom FilterCell for my Grid with a simple "FilterClear" Button. 

    At the beginning of my program, a custom theme gets loaded with changes of the button style. Now i do not want, that my filterclearbuttons looks like the other buttons. I tried to set loRadButtonElement:ElementTree:EnableApplicationThemeName = FALSE. but I get a compile error this way. 

     

    I also tried to set these properties of my button in my override CreateChildElements of my CustomFilterCell.

     

          loRadButtonElement:ButtonFillElement:AutoSize = FALSE.
          loRadButtonElement:ButtonFillElement:Size = NEW System.Drawing.Size(16,16).
          loRadButtonElement:ButtonFillElement:Alignment = System.Drawing.ContentAlignment:MiddleCenter.
          loRadButtonElement:BorderElement:AutoSize = FALSE.
          loRadButtonElement:BorderElement:Size = NEW System.Drawing.Size(16,16).
          loRadButtonElement:BorderElement:Alignment = System.Drawing.ContentAlignment:MiddleCenter.

     

    I am able to change the style this way but it is not looking as expected. 

    i add two images of my current window and how I want it to look like.

     

    It would be wonderful, if someone of you could tell me how to obtain the desired style without changing my custom theme

     

    Sincerely,

    Dominik

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1871 posts

    Posted 14 Feb Link to this post

    Hi Dominik,

    Thank you for writing.

    You cannot switch or disable the theme for a single element. You need to set the button styles manually. In this case, you need to move the button initialization to the constructor:
    public MyFilterCellElement(GridViewDataColumn column, GridRowElement row) : base(column, row)
    {
        button.MinSize = new Size(17, 17);
        button.BorderElement.BackColor = Color.FromArgb(26, 111, 177);
        button.BorderElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        button.BorderElement.BoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
        button.Shape = new Telerik.WinControls.RoundRectShape(0);
        button.ButtonFillElement.BackColor = Color.FromArgb(222, 242, 254);
        button.ButtonFillElement.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
     
        this.Children.Add(button);
        button.Click += Button_Click;
    }

    I hope this will be useful. Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top