0
코드 (C#) 내에서 바인딩 선언 내에서 형식 변환을 수행하고자합니다. 당연히 VS에 대한 경로를 찾지 못하는 불평 - 여기TypeCast 내 바인딩 경로
Binding aBinding = new Binding();
aBinding.Mode = BindingMode.OneTime;
aBinding.ElementName = "FullPagePageViewGrid";
//aBinding.Path = new PropertyPath("((IPageLayout)Children[0])"); // What I'd like to do - causes error
aBinding.Path = new PropertyPath("Children[0]");
aBinding.Converter = new IsSelectedTextBoldConverter();
this.aLabel.SetBinding(Label.ContentProperty, aBinding);
내가받을 오류 발생 :
System.Windows.Data Error: 39 : BindingExpression path error: '((IPageLayout)Children[0])' property not found on 'object' ''Grid' (Name='FullPagePageViewGrid')'. BindingExpression:Path=((IPageLayout)Children[0]); DataItem='Grid' (Name='FullPagePageViewGrid'); target element is 'Label' (Name='aLabel'); target property is 'Content' (type 'Object')
그건 내가 두려워했던거야. 성공적으로 변환기를 사용할 수 있었지만 직접 연결 할 수 있는지 알고 싶었습니다. 감사! – Joel