I would like to turn off the horizontal scrollbar.
I have found some similar questions here, but the mentioned code did not find the scrollwiever.
I would like to achieve the same result as in a visual studio properties pane.
Can you help me please?
Thank you.
Tom
9 Answers, 1 is accepted
presenter = grid.ChildrenOfType<PropertyGridPresenter>().First();
scroll_viewer = presenter.ChildrenOfType<ScrollViewer>().FirstOrDefault();
if (scroll_viewer != null)
scroll_viewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
But it is not working as expected. My Textboxes in datatemplates of propertydefinitions are set with HorizontalAlingment=Strech. RadPropertyGrid is insade docking panel. It can grow indefinitely. How can I allow to grow only to the available dock pane with - label column with?
Thank you very much.
Tom
Generally, you can set LabelColumnWidth property to "*"so that the label takes all the available space rather than its default value of 200. Could you take a look at the sample attached to see whether this is what you expect ? If not, could you update it and send it back so that I can check what your exact requirements are ?
Maya
Telerik
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 >>
Setting the labelColumnWith to * is exactly the opposite what I need.
I need that the second column (valueColumnWith) could be set to *.
But the propertyGrid with should be only the visible with of rad pane and it should not grow indefinitely.
It should be the same behavior as the Property Pane in a Visual Studio.
Thank you very much.
Tom
The template of the PropertyGridField is separated into three columns:
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"{Binding LabelColumnWidth, ElementName=PropertyGridPresenter}"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
The first one is for the indicator at leftmost, the second is for the display names and the last one is for the values and it fills the whole space. And since dock panels measure its children with infinity, the last column will try to fill up the space.
What you can try is to set the Width property of the property grid.
Regards,
Maya
Telerik
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 >>
Doesn't it seem easy and obvious that there could have been a ValueColumnWidth?
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"{Binding LabelColumnWidth, ElementName=PropertyGridPresenter}"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
Telerik, this may have helped.
<
ColumnDefinition
Width
=
"{Binding ValueColumnWidth, ElementName=PropertyGridPresenter}"
/>"
Or give us an easy way to find the column definitions that Thomas pointed out for these three columns so that we set the column widths them as needed.
public
IPropertyGridConfigurationManagerSettings Initialize(RadPropertyGrid propertyGrid)
{
PropertyGrid.Loaded += PropertyGridOnLoaded;
PropertyGrid.SizeChanged += PropertyGridOnSizeChanged;
return
this
;
}
private
void
PropertyGridOnLoaded(
object
sender, RoutedEventArgs routedEventArgs)
{
ScrollViewer = PropertyGrid.ChildrenOfType<ScrollViewer>().First();
}
private
void
PropertyGridOnSizeChanged(
object
sender, SizeChangedEventArgs sizeChangedEventArgs)
{
var valueControlWidth = GetControlMaxWidth();
PopulateProperyDefinitions(valueControlWidth);
}
private
ScrollViewer ScrollViewer {
get
;
set
; }
private
const
double
IndicatorWidth = 30;
// I'm only guessing at this value
private
double
GetControlMaxWidth()
{
var propertyLabelWidth = PropertyGrid.LabelColumnWidth.Value;
return
ScrollViewer.ViewportWidth - (IndicatorWidth + propertyLabelWidth);
}
public
static
DataTemplate DataTemplateMemoEdit(IDynamicProperty dynamicProperty,
double
maxWidth)
{
var dataTemplate =
new
StringBuilder();
dataTemplate.Append(
"<TextBox "
);
dataTemplate.Append(
"AcceptsReturn='true' "
);
dataTemplate.Append(
"Height='Auto' "
);
dataTemplate.Append(
"Text='{Binding ["
+ dynamicProperty.Name +
"], Mode=TwoWay}' "
);
dataTemplate.Append(
"TextWrapping='Wrap' "
);
dataTemplate.Append(String.Format(
"Name='ux{0}' "
, dynamicProperty.Name));
dataTemplate.Append(String.Format(
"MaxWidth='{0}' "
, maxWidth));
dataTemplate.Append(
"/>"
);
var dataTemplateString = String.Format(__dataTemplatePattern, dataTemplate);
return
(DataTemplate)XamlReader.Load(dataTemplateString);
}
Do we have a good solution on this?
thank you...
Tom
In case your scenario is like before - RadPropertyGrid in RadPane - you need to set Width property of the property grid. Since RadPane measures its children with infinity, you need to specify the space the last column (the one holding the values) should take.
Maya
Telerik
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 >>