"Binding"유형의 DependencyProperty를 만드는 데 문제가 있습니다. 다른 형식은 제대로 작동하며 바인딩을 사용하여 채우면 성공적으로 해결됩니다."Binding"유형의 DependencyProperty가 업데이트되지 않습니다.
내 시나리오에서는 DataGrid가 열을 수행하는 것과 거의 같은 방식으로 Raw 바인딩을 잡아서 자식 개체의 속성에 바인딩 할 수 있습니다. 즉, 열에 지정된 각 바인딩에 대해 바인딩합니다. ItemsSource 컬렉션의 각 항목에 DataContext 자체를 바인딩하는 대신
<mg:MultiSelectDataGrid x:Name="Grid" DockPanel.Dock="Left"
ItemsSource="{Binding Path=Rows}" DataContext="{Binding}"
AutoGenerateColumns="False" UriBinding="{Binding Path=UrlItems}">
그리고 내 "MultiSelectDataGrid"에
:public static readonly DependencyProperty UriBindingProperty =
DependencyProperty.Register("UriBinding", typeof(BindingBase),
typeof(MultiSelectDataGrid),
new PropertyMetadata { PropertyChangedCallback = OnBindingChanged});
private static void OnBindingChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
// This is never enterred
}
public BindingBase UriBinding
{
get { return (BindingBase)GetValue(UriBindingProperty); }
set { SetValue(UriBindingProperty, value); }
}
라는 결코 극복 콜백, 결코 설정되지 가져옵니다 속성입니다. 콜백을 사용하여 모든 종류의 순열을 시도했습니다. 나에게 어떤 성공을 준 유일한 이유는 바인딩을 문자열 (예 : UriBinding = "hello")로 대체 한 경우였습니다.이 경우 콜백을 실행하고 속성을 설정하지만 물론 실패합니다. 잘못된 유형.
내가 뭘 잘못하고 있니? 이 예제의 전체로드를 봤는데, 이것이 DataGrid가 수행해야하는 작업이라고 생각합니다.
감사