How can I bind to a property on the PropertyGridFieldStyle?

2 posts, 0 answers
  1. Magnus
    Magnus avatar
    3 posts
    Member since:
    Feb 2015

    Posted 26 Oct 2015 Link to this post

    Hi! I know how to set a custom style for the field of a property grid but I cant figure out how I am supposed to make that style bound to anything that is relative to the specific PropertyDefinition of that field.
    The PropertyGridField's PropertyDefinition is the default source the style's binding. The binding path of the PropertyDefinition might be "Communication.Timeout" but I want to bind the FontWeight property to "Communication.TimeoutProperty.Mode". How can this be done? 


    Do I have to create a subclass of PropertyDefinition with my own dependency properties on to be able to do this?  

        Item="{Binding SelectedItem}"
        FieldStyle="{DynamicResource PropertyGridFieldStyle}"
            <Style x:Key="PropertyGridFieldStyle"
                   TargetType="{x:Type telerik:PropertyGridField}"
                   BasedOn="{StaticResource PropertyGridFieldStyle}">                   
                        <Setter Property="FontWeight" Value="{Binding Path=???}"/>
  2. Stefan
    Stefan avatar
    792 posts

    Posted 29 Oct 2015 Link to this post

    Hi Magnus,

    I am afraid, that it would not be possible to achieve such binding, as the DataContext of the PropertyGridField is the PropertyDefinition, which does not have such property defined. A possible resolution would be to use a RelativeSource in the TextWeight binding and bind it to an element, as per your requirements.

    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