Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1540
ContentPane nested in UserControl nested in another ContentPane causing havoc with close buttons
posted


I have the following Page defined in XAML:

<Page ...>
  <DockPanel>
    <igDock:XamDockManager>
      <igDock:XamDockManager.Panes>
        <igDock:SplitPane>
          <igDock:TabGroupPane Name="tgp" />

 

I also have the following UserControl defined in XAML:

<UserControl x:Class="MyNamespace.MyClass" ...>
  <igDock:XamDockManager>
    <igDock:XamDockManager.Panes>
      <igDock:SplitPane>
        <igDock:ContentPane Name="cp1" AllowClose="False" />
        <igDock:ContentPane Name="cp2" AllowClose="True" />

 

I then add instances of MyClass to TabGroupPane tgp using the following code:

ContentPane cpNew = new ContentPane();
cpNew.Content = new MyClass();
tgp.Items.Add(cpNew);

 

The problem I am having is that the close button of ContentPane cp1 in my UserControl is enabled even though I've specified AllowClose="False". However, when pressed, it actually closes the entire nesting ContentPane cpNew created in the code. It's like the close buttons on nested ContentPane panes' headers within cpNew are really copies of the close button on cpNew's header. Interestingly, if I set cpNew.AllowClose = false in my code before adding it to tgp, the close button of the nested ContentPane pane cp2 is enabled when selected but disabled when cp1 is selected. But when I press it, it closes cp2 as I would expect but cáusés the Closed event handler of the nesting ContentPane cpNew to fire!

What I want is to be able to have cp1 and cp2's close buttons affect just those panes and the enabled status of those close buttons to be configured separately to the nesting ContentPane.

Is the scenario described above by design or is this a problem with ContentPane?