Disable RadPropertyGrid Horizontal Scrolling

6 posts, 0 answers
  1. Jonah
    Jonah avatar
    29 posts
    Member since:
    Oct 2012

    Posted 12 Feb 2014 Link to this post

    I have several textboxes in my property grid that are sometimes larger than the grid, I don't want the grid to scroll horizontally. I added code in the loaded event to disable the scrollbar which works well. However when I click the category or A-Z button the scrollbar appears. I tried using the sorted and grouped method to disable the scrollbar but that doesn't seem to work. Any suggestions?
  2. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 17 Feb 2014 Link to this post

    Hi Jonah,

    I would suggest you to use RadPropertyGrid with RenderMode="Flat". Then you can disable the horizontal scrollbar in the Loaded event like so:
    private void RadPropertyGrid_Loaded(object sender, RoutedEventArgs e)
           {
               (sender as RadPropertyGrid).ChildrenOfType<VirtualizingStackPanel>().First().ScrollOwner.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
           }

    Please give it a try and let me know how it works for you.

    Regards,
    Yoan
    Telerik

    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jonah
    Jonah avatar
    29 posts
    Member since:
    Oct 2012

    Posted 17 Feb 2014 in reply to Yoan Link to this post

    Thanks, that worked great!
  5. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 18 Feb 2014 Link to this post

    Hi Jonah,

    I am glad to hear that. Let me know if any additional questions arise.

    Regards,
    Yoan
    Telerik

    Check out the new Telerik Platform - the only modular platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native apps. Register for the free online keynote and webinar to learn more about the Platform on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT).

  6. haochen
    haochen avatar
    13 posts
    Member since:
    Jun 2014

    Posted 17 Jun 2015 in reply to Yoan Link to this post

    Hi Yoan,

     

    If I can't set RenderMode to 'Flat', How do I disable the horizontal scroll?

    Because when I use tab to switch the focus it's not working when RenderMode is 'Flat'.

  7. Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 18 Jun 2015 Link to this post

    Hello,

    Actually, you can disable the navigation which comes from the Flat mode. You can use the EnableBuiltInNavigation property of the PropertyGridCommandProvider. Please check the following code snippet for a reference:
    public MainWindow()
            {
                InitializeComponent();
     
                this.RadPropertyGrid.CommandProvider = new CustomKeyboardCommandProvider(this.RadPropertyGrid);
            }
        }
     
        public class CustomKeyboardCommandProvider : PropertyGridCommandProvider
        {
            public CustomKeyboardCommandProvider()
                : base(null)
            {
     
            }
     
            public CustomKeyboardCommandProvider(RadPropertyGrid propertyGrid)
                : base(propertyGrid)
            {
                this.PropertyGrid = propertyGrid;
                this.EnableBuiltInNavigation = false;
            }
        }

    I hope this will work for you.

    Regards,
    Yoan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready