npolyak / NP.Avalonia.UniDock

MIT License
160 stars 16 forks source link

More control over DockItem closing #9

Open Brayconn opened 2 years ago

Brayconn commented 2 years ago

I'm attempting to implement two features in my program:

  1. An "Are you sure you want to close?" dialog when the user tries to close a tab with unsaved changes
  2. A project settings menu that's toggleable by a checkbox

For the former, I need to be able to prevent a DockItem from closing when the user doesn't say "yes" to a dialog box. For the latter, I need to be able to close the DockItem from code for when the user loads a different/creates a new project.

The closest I got to the first functionality was by registering a Button.ClickEvent handler and checking if((e.Source as Button).Name == "CloseButton"), but that method still can't prevent the DockItem from closing. I didn't make any progress on closing the DockItem from code.

npolyak commented 1 year ago

sorry, I'll try to work on it in the near future.