Binding Warning When Expand Nested Property - FieldIndicatorVisibility

5 posts, 1 answers
  1. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 15 May 2015 Link to this post

    verson: 2014.3.1021.40

    xaml:

    <telerik:RadPropertyGrid x:Name="grdTestProperty"
                              Item="{Binding TestProperty, Mode=OneWay}" SearchBoxVisibility="Collapsed" SearchInNestedProperties="False"
                              FieldIndicatorVisibility="Visible"
                              AutoGeneratePropertyDefinitions="True"
                              NestedPropertiesVisibility="Visible"
                              LabelColumnWidth="110" RenderMode="Flat"
                              AutoGeneratingPropertyDefinition="grdTestProperty_AutoGeneratingPropertyDefinition" />

     

    Code Behind:

    private void grdTestProperty_AutoGeneratingPropertyDefinition(object sender, Telerik.Windows.Controls.Data.PropertyGrid.AutoGeneratingPropertyDefinitionEventArgs e)
            {
                // Encounter this warning when set IsExpanded = true:
                e.PropertyDefinition.IsExpanded = true;
            }

     

    Nested Property:

    [DataMember()]
    [Browsable(true)]
    [Display(Order = 5, GroupName = "PropGroup_Electrical", Name = "PropName_ElecItem", Description = "PropDesc_ElecItem", ResourceType = typeof(UIStringTable))]
    public ElectricalTestItem ElecItem
    {
        get { return m_ElecItem; }
        private set
        {
            m_ElecItem = value;
            NotifyOfPropertyChange(() => ElecItem);
        }
    }

     

    Warning:

    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.RadPropertyGrid', AncestorLevel='1''. BindingExpression:Path=FieldIndicatorVisibility; DataItem=null; target element is 'Grid' (Name='FieldIndicator'); target property is 'Visibility' (type 'Visibility')

  2. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 18 May 2015 Link to this post

    view model for the xaml (which contains the property grid):

    public class TestPropertyViewModel : PaneViewModel, IHandle<TestListEntity>
    {
            public TestItem TestProperty
            {
                // Bind to property grid.
                get { return m_TestItem; }
                set
                {
                    m_TestItem = value;
                    NotifyOfPropertyChange(() => TestProperty);
                }
            }
    }

    TestItem class which contains the Nested Property ElectricalTestItem

    public class TestItem : PropertyChangedBase
    {
        [DataMember()]
        [Browsable(true)]
        [Display(Order = 5, GroupName = "PropGroup_Electrical", Name = "PropName_ElecItem", Description = "PropDesc_ElecItem", ResourceType = typeof(UIStringTable))]
        public ElectricalTestItem ElecItem
        {
            get { return m_ElecItem; }
            private set
            {
                m_ElecItem = value;
                NotifyOfPropertyChange(() => ElecItem);
            }
        }
    }

     

     I would like to expand the nested property when the property grid's Item has changed. 

     Why expanding the nested property with the code behind generates the warning - even though the nested property did expand in the view? Have i missed out anything?

    p/s:  Expanding the nested property by clicking the "+" sign is OK. 

  3. UI for WPF is Visual Studio 2017 Ready
  4. Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 19 May 2015 Link to this post

    Hi Joel,

    As I am not able to reproduce such warning with the version you are using, I am attaching a sample project. Would it be possible for you to modify in a way that reproduces the error, open a new support thicket and attach it in it, so I can debug it on my side and guide you accordingly?

    Best Regards,
    Stefan X1
    Telerik
    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
  5. Joel
    Joel avatar
    53 posts
    Member since:
    Sep 2013

    Posted 20 May 2015 in reply to Stefan X1 Link to this post

    Hi Stefan,

     I have submitted a support ticket ID: 936977

     Instead of assigning the property item at Load, I have created a button to assign the property when it is clicked.

    void btnShow_Click(object sender, RoutedEventArgs e)
    {
        this.propertyGrid.Item = Club.GetClubs().ElementAt(0);
    }

  6. Answer
    Stefan X1
    Admin
    Stefan X1 avatar
    523 posts

    Posted 21 May 2015 Link to this post

    Hi Joel,

    Thank you for the provided project.

    This error is harmless and is handled internally by the Framework. Please check the Resolving harmless binding errors in WPF blog post, as well the System.Windows.Data Error: 4 : Cannot find source for binding with reference in WPF Tree View / Tree View Item forum thread for further reference.


    Best Regards,
    Stefan X1
    Telerik
    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
UI for WPF is Visual Studio 2017 Ready