结构是Windows+Frame里Page页,现在在Page页实现DataGrid的增删改查,
其中修改中的代码是 Command="{Binding Path=DataContext.UpdCompanyCommand,
RelativeSource={RelativeSource AncestorType={x:Type Window}}}"/>,
需要弹出一个Window窗口,但有Output中有错误Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=DataContext.UpdateDrugClassCommand; DataItem=null; target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')。我有试过在Windows中直接调用是可以出现另一个Window窗口的。