【问题标题】:Adding the userControl to the DockPanel didn't effect Dynamically in Wpf将 userControl 添加到 DockPanel 在 Wpf 中不会动态影响
【发布时间】:2012-06-05 12:34:07
【问题描述】:

我是 Wpf 的新手。一个 UserControl (Wpf UserControl) 添加到 DockPanel 并在某些操作中 O 替换了第一个 UserControl 动态地与 DockPanel 中的另一个 UserControl 一起使用。但是第一个 UserContorl 保持可见,第二个 UserControl 未显示 在 DockPanel 中。

我不知道我应该怎样做的正确行为 动态加载。我添加了这段代码(这段代码执行得很好) 但它不反映显示“CtlAddEmployee”的操作 在 Dockpanel 中进行控制。

CtlAddEmployee frm2 = new CtlAddEmployee(str);
        DockPanelInRibbon.Children.Clear();
        DockPanelInRibbon.Children.Add(frm2);

在我之前的问题中询问了它的工作原理的完整细节 详细方式:

Loading another userControl in wpf Ribbon Window when the we click on DataGrid row

请提供解决方案。

【问题讨论】:

    标签: wpf oop events


    【解决方案1】:

    这里我需要引用旧对象而不是新创建的对象来引用相应的类...

    为了更好地使用参数化构造函数..

    【讨论】:

      猜你喜欢
      • 2012-07-02
      • 1970-01-01
      • 2015-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-18
      相关资源
      最近更新 更多