using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Security.RightsManagement; using System.Text; using System.Threading.Tasks; using Dragablz; using Dragablz.Dockablz; using DragablzDemo.Annotations; namespace DragablzDemo { public class BoundExampleModel { private readonly IInterTabClient _interTabClient = new BoundExampleInterTabClient(); private readonly ObservableCollection _items; private readonly ObservableCollection _toolItems = new ObservableCollection(); public BoundExampleModel() { _items = new ObservableCollection(); } public BoundExampleModel(params HeaderedItemViewModel[] items) { _items = new ObservableCollection(items); } public ObservableCollection Items { get { return _items; } } public static Guid TabPartition { get { return new Guid("2AE89D18-F236-4D20-9605-6C03319038E6"); } } public IInterTabClient InterTabClient { get { return _interTabClient; } } public ObservableCollection ToolItems { get { return _toolItems; } } public ItemActionCallback ClosingTabItemHandler { get { return ClosingTabItemHandlerImpl; } } /// /// Callback to handle tab closing. /// private static void ClosingTabItemHandlerImpl(ItemActionCallbackArgs args) { //in here you can dispose stuff or cancel the close //here's your view model: var viewModel = args.DragablzItem.DataContext as HeaderedItemViewModel; Debug.Assert(viewModel != null); //here's how you can cancel stuff: //args.Cancel(); } public ClosingFloatingItemCallback ClosingFloatingItemHandler { get { return ClosingFloatingItemHandlerImpl; } } /// /// Callback to handle floating toolbar/MDI window closing. /// private static void ClosingFloatingItemHandlerImpl(ItemActionCallbackArgs args) { //in here you can dispose stuff or cancel the close //here's your view model: var disposable = args.DragablzItem.DataContext as IDisposable; if (disposable != null) disposable.Dispose(); //here's how you can cancel stuff: //args.Cancel(); } } }