This is a migrated thread and some comments may be shown as answers.

How can I stop the property window from resizing with content

7 Answers 259 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 14 Jun 2012, 02:10 PM
I have a property grid and it shows a scroll bar when the text is to long.  I want it to work like in visual studio where there is no huge ugly scroll bar at the buttom of the grid.  I have tried changing the "Scroll Viewer" for the grid but it dosn't seem to do anything.  It is in a dockable window so I can not just set the width of the text box as well.

7 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 14 Jun 2012, 02:20 PM
Hello Alex,

You can set hard-coded Width value for both fields and RadPropertyGrid itself, like this:
<Grid>
        <Grid.Resources>
            <Style TargetType="telerik:PropertyGridField">
                <Setter Property="Width" Value="400" />
            </Style>
        </Grid.Resources>  
        <telerik:RadPropertyGrid x:Name="rpg" Item="{Binding Employee}" Width="402">            
        </telerik:RadPropertyGrid>
    </Grid>


Kind regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Alex
Top achievements
Rank 1
answered on 14 Jun 2012, 02:21 PM
I can't do that.
0
Ivan Ivanov
Telerik team
answered on 14 Jun 2012, 02:43 PM
Hi,

Another option would be to subscribe to RadPropertyGrid's Loaded event and disable scrollviewer's horizontal scrolling like this:
private void rpg_Loaded(object sender, RoutedEventArgs e)
{
    (sender as RadPropertyGrid).ChildrenOfType<ScrollViewer>().First(sv => sv.Name == "PART_ItemsScrollViewer").HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
}
Alternatively you may modify RadPropertyGrid's template setting HorizontalScrollBarVisibility there.

Kind regards,
Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Alex
Top achievements
Rank 1
answered on 14 Jun 2012, 03:09 PM
Thank you that was what I needed.
0
Felix
Top achievements
Rank 1
answered on 11 Jul 2013, 01:42 PM
I can not find any ScrollViewer in the Control Template of the RPG. Your code (for the Loaded Event) throws an Exception.

I am using the most current Version/Hotfix of Q2.2013 from July, 8.

How to disable the horizontal Scrollbar with the current version?

Thanks
Felix
0
Maya
Telerik team
answered on 16 Jul 2013, 08:36 AM
Hello Felix,

The thing is that we have made some improvement on introducing virtualization and this scroll viewer is not present. What you need to do now is to find the one in the PropertyGridPresenter:

private void propertyGrid_Loaded(object sender, RoutedEventArgs e)
        {
            var proeprtyGridPresenter = this.propertyGrid.ChildrenOfType<PropertyGridPresenter>().FirstOrDefault();
            if (proeprtyGridPresenter != null)
            {
                var scrollViewer = proeprtyGridPresenter.ChildrenOfType<ScrollViewer>().FirstOrDefault();
                if (scrollViewer != null)
                {
                    scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
                }          
            }
        }

I hope this does not cause much trouble on your side.  

Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Felix
Top achievements
Rank 1
answered on 16 Jul 2013, 09:34 AM
Hello Maya,

this works great. Thank you!

Felix
Tags
PropertyGrid
Asked by
Alex
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Alex
Top achievements
Rank 1
Felix
Top achievements
Rank 1
Maya
Telerik team
Share this question
or