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

PropertyGrid Editor Template

3 Answers 118 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Alexandru
Top achievements
Rank 1
Alexandru asked on 18 Nov 2013, 09:56 AM
Hi!

I'm using a PropertyGrid which, for some string properties, requires a custom control a made, LinkTextBox.
I created a datatemplate,
            <DataTemplate x:Key="linkTextBoxDataTemplate">
                <Wpf:LinkTextBox TextMaxLength="4000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                                 telerik:AutoBindBehavior.UpdateBindingOnElementLoaded="Text"/>
            </DataTemplate>
where Text is the name of the control's property the property grid property is bounded to. I noticed this is required for binding.

I have 2 problems.
1. I need to access at runtime the LinkTextBox instance, for the current selected property. Using grdPropr.SelectedPropertyDefinition.EditorTemplate I get the above template, but I cannot navigate in the Visual/Logical tree. I can't use the .LoadContent() method, because this gives me e new instance of my control, not the one inside the PropertyGrid
2. When using a custom EditorTemplate, like this one, I noticed that when clicking in the control doesn't actually select the property in the PropertyGrid. When using the default template, clicking in the TextBox (which is the default editor for strings) automatically selects the current property

Thanks,
Alex

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 21 Nov 2013, 08:21 AM
Hi Alex,

As to your questions:
1. You can try to find the LinkTextBox instance with the ChildrenOfType extension method.
2. What is the result if you place a TextBox with your custom template?

Regards,
Didie
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
Ye HaoChen
Top achievements
Rank 1
answered on 24 Feb 2014, 08:32 AM
Hi Didie,

My question is the same as his first question.
If I used an instance of RadPropertyGrid passed as a parameter to the ChildrenOfTypeExtensions.ChildrenOfType(), the return value is null. and if I used an instance of PropertyDefinition passed as a parameter to the  ChildrenOfTypeExtensions.ChildrenOfType() will be throw an exception like this:
Telerik.Windows.Controls.Data.PropertyGrid.PropertyDefinition' is not a Visual or Visual3D.
0
Dimitrina
Telerik team
answered on 24 Feb 2014, 11:14 AM
Hi,

The ChildrenOfType extension method will find the children of the control in the visual tree, i.e. it will search for the specified type in the visual tree.

May I ask you to explain what exactly would you like to achieve?

Regards,
Didie
Telerik
Tags
PropertyGrid
Asked by
Alexandru
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ye HaoChen
Top achievements
Rank 1
Share this question
or