C# &引用;附件“不动产”;PropertyChangedCallback从不要求我的LayoutCallable,而是在DockingManager上工作。阿瓦朗多克

C# &引用;附件“不动产”;PropertyChangedCallback从不要求我的LayoutCallable,而是在DockingManager上工作。阿瓦朗多克,c#,wpf,mvvm,attached-properties,avalondock,C#,Wpf,Mvvm,Attached Properties,Avalondock,我试图在AvalonDock中使用AttachedProperty,我希望它成为LayoutAcrolable的一部分,但PropertyChangedCallback从未被调用。我已经绑定了AttachedPropert,并且我正在获得对ViewModel的控制权,即:当绑定属性更改时,它将触发我的ViewModel属性 我的附件属性 public static readonly DependencyProperty IsCanVisibleProperty = Depende

我试图在AvalonDock中使用
AttachedProperty
,我希望它成为
LayoutAcrolable
的一部分,但
PropertyChangedCallback
从未被调用。我已经绑定了
AttachedPropert
,并且我正在获得对
ViewModel
的控制权,即:当绑定属性更改时,它将触发我的
ViewModel
属性

我的
附件属性

public static readonly DependencyProperty IsCanVisibleProperty =
        DependencyProperty.RegisterAttached("IsCanVisible", typeof(bool), typeof(AvalonDockBehaviour), new FrameworkPropertyMetadata(new PropertyChangedCallback(IsCanVisiblePropertyChanged)));

    private static void IsCanVisiblePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        LayoutAnchorable control = d as LayoutAnchorable;
        if (control != null)
        {
            control.IsVisible = (bool)e.NewValue;
        }
    }
    public static void SetIsCanVisible(DependencyObject element, bool value)
    {   
        element.SetValue(IsCanVisibleProperty, value);
    }

    public static bool GetIsCanVisible(DependencyObject element)
    {
        return (bool)element.GetValue(IsCanVisibleProperty);
    }
XAML

  <xcad:DockingManager>               
     <xcad:LayoutRoot >                 
        <xcad:LayoutPanel Orientation="Horizontal" >       
            <xcad:LayoutAnchorablePane >                                
                  <xcad:LayoutAnchorable Title="Folder" behv:AvalonDockBehaviour.IsCanVisible="{Binding IsHideExplorer, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                       <Views:ExplorerView DataContext="{Binding ExplorerViewModel}"/>
                  </xcad:LayoutAnchorable>
            </xcad:LayoutAnchorablePane>
        </xcad:LayoutPanel>
      </xcad:LayoutRoot>
  </xcad:DockingManager>

我已尝试将属性附加到
DockingManager
PropertyChangedCallback
功能。任何帮助人员。

您是否已经检查了LayoutTable的数据上下文?可能DataContext没有传递给它。在这种情况下,绑定将无法工作,并且您的DependencyProperty不会更新

    private bool _IsHideExplorer;
    public bool IsHideExplorer 
    {
        get { return _IsHideExplorer; }
        set { _IsHideExplorer = value; NotifyPropertyChanged(); }
    }