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

Binding Warning When Expand Nested Property - FieldIndicatorVisibility

4 Answers 167 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Iron
Joel asked on 15 May 2015, 08:39 AM

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')

4 Answers, 1 is accepted

Sort by
0
Joel
Top achievements
Rank 1
Iron
answered on 19 May 2015, 01:13 AM

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. 

0
Stefan
Telerik team
answered on 19 May 2015, 11:39 AM
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
0
Joel
Top achievements
Rank 1
Iron
answered on 20 May 2015, 06:27 AM

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);
}

0
Accepted
Stefan
Telerik team
answered on 21 May 2015, 03:37 PM
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
Tags
PropertyGrid
Asked by
Joel
Top achievements
Rank 1
Iron
Answers by
Joel
Top achievements
Rank 1
Iron
Stefan
Telerik team
Share this question
or