MVVM Docking issues.

Hello,


In our application we are using the MVVM implementation of the DockingManager with use of the DockingAdapter as provided in your samples.

We want to combine the use of your RibbonControl + The MVVM Docking implementation to show/hide tools on demand.
(For example like Visual Studio does it :  " View > Solution Explorer " )

We are facing the following issues : 

     1 : How to synchronize a viemodels dockstate (as in the mvvm sample) with the dockingadapter (wrapped) dockstate in the dockingmanager.

     2 : How to properly work with persistent states ( When deserializing the viewmodel needs to be updated.)
     
     3 : When using the Ribbon control provided by you we would like to press a button to show a single tool ( Thus we would have a button for each tool)  , this all has to happen in MVVM.


Thanks in advance for any help that you can provide! 

5 Replies 1 reply marked as answer

SG Sangeetha Ganesan Syncfusion Team May 26, 2021 03:55 PM UTC

Hi Erik,  
Thanks for contacting Syncfusion Support.  
  
We are validating the reported query from our end. We will update you the further details on 28th May 2021. We appreciate your patience until then. 
 
Regards,  
Sangeetha G 



ER Erik June 18, 2021 08:38 PM UTC

Any update?

I am also facing another issue with a property grid. 

I have a list with different file types for each file type i have "Export Arguments"

For each file type on double click these arguments get loaded as properties. 
I then edit said properties and select another and once i try to select anything in the property grid it gives a null reference : 


System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Syncfusion.PropertyGrid.Wpf
  StackTrace:
   at Syncfusion.Windows.PropertyGrid.PropertyGrid.GetCategory()
   at Syncfusion.Windows.PropertyGrid.PropertyGrid.UpdateSelectedCategory()
   at Syncfusion.Windows.PropertyGrid.PropertyViewItem.OnIsSelectedChanged(DependencyPropertyChangedEventArgs args)
   at Syncfusion.Windows.PropertyGrid.PropertyViewItem.OnIsSelectedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   at Syncfusion.Windows.PropertyGrid.PropertyViewItem.set_IsSelected(Boolean value)
   at Syncfusion.Windows.PropertyGrid.PropertyViewItem.OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at WolvenKit.App.Main()


BR Bharathi Rajakantham Syncfusion Team June 21, 2021 12:34 PM UTC

Hi Erik, 

Thanks for your Patience. 

We have prepared a sample achieving your requirement and also, we don’t face any NullArgumentException with the PropertyGrid. Please check the sample and the video for your reference. 




Please ensure our sample and let us know whether our replication procedure is same as yours. If not please share the issue reproducing sample and the video to procced further on this. It will be helpful for us to provide a prompt solution on this. 

Regards, 
Bharathi R 


Marked as answer

AA Aaronbradfordwork September 23, 2022 01:07 PM UTC

Hello, I am also looking for an answer to these original questions: 
    
1 : How to synchronize a viemodels dockstate (as in the mvvm sample) with the dockingadapter (wrapped) dockstate in the dockingmanager.

     2 : How to properly work with persistent states ( When deserializing the viewmodel needs to be updated.)
     
After generating a window for each dock using the docking adapter how do you then go and assign those dockstates from the viewmodel? 


GT Gokul Thanudhas Syncfusion Team September 26, 2022 05:02 PM UTC

Hi AaronBradfordwork,


We have created the sample based on your requirement. Please refer the sample from the attachment for your reference.


  1. In the sample for synchronizing the dockingmanager dockstate with ViewModel Dockstate we have used binding the ViewModel dockstate with dockingmanager dockstate.


           Code Snippets

        

                          ContentControl control = new ContentControl() { Content = item };

                            DockingManager.SetHeader(control, ((IDockElement)item).Header);

                            Binding c_dockcontent = new Binding();

                            c_dockcontent.Source = (item as IDockElement);

                            c_dockcontent.Mode = BindingMode.TwoWay;

                            c_dockcontent.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                            c_dockcontent.Path = new PropertyPath("State");

                            control.SetBinding(DockingManager.StateProperty, c_dockcontent);


          2. For persisting the state, we have created the method in the DockingAdapter.xaml.cs and accessed                     through the action delegate from the ViewModel


Regards,

Gokul T.




Attachment: DockingDemo_(2)_6c63e1a3.zip

Loader.
Up arrow icon