PropertyGrid Editor Template

4 posts, 0 answers
  1. Alexandru
    Alexandru avatar
    3 posts
    Member since:
    May 2013

    Posted 18 Nov 2013 Link to this post

    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

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 Nov 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ye HaoChen
    Ye HaoChen avatar
    27 posts
    Member since:
    Nov 2009

    Posted 24 Feb 2014 Link to this post

    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.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 24 Feb 2014 Link to this post

    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
Back to Top