I would like to remove them as this is causing me lots of problems. If there is a way to solve it I will be glad to try it.
First few minutes of using it I have gotten like 3 different exceptions and I can’t figure out how to remove those damn options.
Pinning and unpinning and pinning, throws an InvalidOperationException because the Operation is not valid due to the current state of the object.
Sometimes pinning and unpinning will open a dialog box and ask me for a file, I don’t want that to happen but it is happening and it throws an exception.
I accidentally click the close button and I cannot get the window back.
It is really frustrating. I am sure other avalondock users have come across this.
And as I don’t want to waste too much time, I am going to ask right here.
How did you get around this exceptions or remove those buttons? Thanks.
I had exactly the same problem as yours. Not willing to remove the icons from the actual UI, I just disabled them with event handlers
Here is how I worked:
To remove those Hide and AutoHide commands:
I added the following handler:
This is what
ContentClosinglooks like:}
}
This handler was here to actually close the right content. Fore some reason, sometimes
AvalonDockwill close another content because it has the focus (clicking on the cross won’t give focus to your content, and thus it will close the currently focused content…)As you can see, I just override the events and close manually my components
Unfortunately, this does not cover all the cases. I also had for some reason (hello buggy AvalonDock) to actually catch the click on the close button because there is an edge case: If you remove the last component, you won’t be able to add a new component, because
AvalonDockwill remove the last remaining panel. Moreover, if you close aDockableContentwith many tabs in it,AvalonDockwill close all the tabs, so I had to implement something to just close the current tab (which makes more sense imho) I had to add a mouse down handler to each content added to catch this event. With the following trick, I could do a workaround to avoid this bug:Again, this is an incredible big work for such small matters, but unfortunately, this
AvalonDockis far from being production-environment ready and I had to tweak such things to make it work.Hope it’ll work for you as well and save yourself some headaches I’ve already given to this problem!