Serializing the QAT

Ribbon for WPF Forum

Posted 15 years ago by Magnus Eklof
Version: 4.5.0486

I have a problem serialize/deserialize the QAT if it contains our own commands (inherited from RoutedUICommand) and I suspect there is (in part at least) a namespace problem.

This is what a serialized command looks like
                <ribbon:Button Context="QuickAccessToolBarItem" Id="New" VariantSize="Small">
                        <av:RoutedUICommand Text="_Ny" />
it looks like it lacks some things, I did a test editing the xml before starting the app as such:
                <ribbon:Button Command="f:FastNetCommands.New" Context="QuickAccessToolBarItem" Id="New" VariantSize="Small">
and also included our namespace:
and it worked fine DeSerializing this into the ribbon.

Any ideas about this?


Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Magnus,

Can you email over a simple sample project that shows the issue happening and we'll debug it to see what can be done? Thanks!

Actipro Software Support

Posted 15 years ago by Magnus Eklof
Thanks, I have emailed a testproject to the support address.
Posted 15 years ago by Magnus Eklof
Pasting the response for others...


The main problem here is that XAML serialization (Microsoft's code) which is what we use to serialize the the QAT data, doesn't retain a static reference to your command. When it pulls in your command initially, the command is then set on the Command property and all ties to the static MyCommands class are gone. Thus it is serialized as a normal RoutedUICommand that is not tied back up to the MyCommands instance when deserialized. You can see this in the XML.
When you load the XML back, it is creating your button and loading the "unattached" command from the XML properly. However since that "unattached" command doesn't have a handler, the button is disabled and therefore appears like whitespace (since the "unattached" command isn't pulling your UI either).
What you may need to do is reattach the proper commands after deserilizing the QAT. Either that or modify your XML manually so you add a namespace ref to the namespace that contains MyCommands and change the Command value on the button so it references that. Alternatively try and find a way to serialize the reference to your MyCommands class via some other way of specifying the command in your original XAML, but so far our tests haven't found a way to do that.
The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.