I've tried to search a forum, but couldn't find any quick and easy solution/answerr:
the case is that in our app one type of panes (1) cannot be closed - should always be opened, so user can only pin/unpin it (i.e navigation pane, or some 'control' pane for specific tasks), the second panes type (2) are opened when user i.e double click an object to see some details - and those panes can be closed
for (1) when user undock it as floating window, it should only be possible to dock it back to the main dock area, not close
for (2) it should be possible to close it and pint it back.
also what is the proper way to close the pane - I mean dispose it and control inside also, not hide ?
We also do not want to show captions, so the question is how to show the pin/unpin button in the tab and in floating window - or how to handle close button so (1) type will be docked back and (2) will be closed ?
the only thing I have found is really old solution to create custom button in IUIElementCreationFilter
I have been investigating into the behavior you are looking to achieve in this case, and I have some information for you. The below responses will be in the order of the inquiries you have provided:
1. Allowing Closing: You can allow or disallow closing of a pane by setting the Settings.AllowClose property on the underlying DockableControlPane. You can use the following code for this, where “pane1” is a DockableControlPane:
pane1.Settings.AllowClose = Infragistics.Win.DefaultableBoolean.False;
2. Disposal: When a pane’s close button is pressed, it will be hidden or “Closed” in this case, but it and its control will still be a part of the UltraDockManager. If you want to completely dispose of it, you can handle the PaneHidden event of the UltraDockManager. The event arguments of this event will get you the pane that was hidden, and you can take actions on it. For example, if you want to remove it completely, you can call Dispose() on it, as well as removing it from its Parent DockAreaPane.Panes collection.
3. Floating Window Button Handling / Pin Button: The pin button will not show on a floating window because for a pane to be pinned or unpinned, it first needs to be docked, and so if you are looking to achieve this, an IUIElementCreationFilter likely would be the best bet. That said, if you are looking to do the alternative where you handle the close button, this is possible.
The best thing I can recommend to handle the close button is to handle the BeforePaneButtonClick event, as this event is cancellable and also returns you the button that you clicked. If you find that the e.Button is PaneButton.Close, you can call e.Pane.Dock(true); (where ‘e’ is the event arguments). This will return the pane back to its previous state. Then, you should be able to set e.Cancel = true to prevent any action that normally would happen by clicking the Close button to handle the Close button click.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
thank you for clarification.
Just one more thing want to make sure if is possible or not: place pin/unpin button in the group tabs (the same as close button) ? If this is only possible using custom button via creation filter - is it possible to 'reuse' the infragistics internal pin/unpin button so it will have the same L&F ?Using close button to unpin the tab might be misleading for user ...
I am a little bit unsure of the exact functionality you are looking for here – there are a few different “styles” for the child panes of a DockableGroupPane, which is what I am under the impression you are referring to here by “group tabs.” If you are able to confirm this, I may be able to confirm whether or not it is possible to place the pin button within, although I do not believe it will be possible outside of a creation filter if my impression is correct on this matter.
Regarding reusing the Infragistics pin/unpin button, this would most easily be done by using a custom one by defining an .isl through AppStylist, as this would allow you to change the pin button to your own image or icon that is not modified or created in code, which the internal pin/unpin button is, and so it’s not really possible for me to “share” the button’s image for you in this case.
Please let me know if you have any other questions or concerns on this matter.