Problem with Padding Property

2 posts, 0 answers
  1. ztn
    ztn avatar
    2 posts
    Member since:
    Sep 2008

    Posted 02 Oct 2014 Link to this post

    Greetings.

    I changed the Padding property to All 0 in design mode, the code:

    this.radDock1.Padding = new System.Windows.Forms.Padding(0);

    was in the designer file, but at runtime the dock still has Padding 4.

    I put the code after the InitializeComponent function and did not work.

    finally i put the code in the Load event of the form and take effect in runtime.

    I am using the last release of rad Controls with framework 3.5.

    Regards.
  2. George
    Admin
    George avatar
    500 posts

    Posted 07 Oct 2014 Link to this post

    Hello Jean,

    Thank you for writing.

    You observe this behavior since the theme sets the padding to the RootElement of RadDock after the InitializeComponent call. You can cancel the setting of this value:
    this.radDock1.RootElement.RadPropertyChanging += RootElement_RadPropertyChanging;
    .....
    void RootElement_RadPropertyChanging(object sender, Telerik.WinControls.RadPropertyChangingEventArgs args)
    {
        var valueSource = ((RootRadElement)sender).GetValueSource(args.Property);
        if (args.Property == RootRadElement.PaddingProperty && valueSource == ValueSource.Style)
        {
            args.Cancel = true;
        }
    }

    You can also set the value after the theme has set it - in the Load event.

    Let me know, should you have further questions.

    Regards,
    George
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top