Quantcast
Channel: Ribbon for WPF - Recent Posts
Viewing all articles
Browse latest Browse all 1458

Ribbon - Prism - OpenFile Command

$
0
0

Hi,

I am currently testing the Ribbon, although this is not a question directly related to this control. I have a DelegateCommand, OpenFileCommand, which can take a String (the file path), but not necessarly (the same command is used to open the Open File Dialog, in case the String is Null). I get the following error, at runtime:

Unable to cast object of type 'ActiproSoftware.Windows.Controls.Ribbon.Input.CheckableCommandParameter' to type 'System.String'

Here is a workaround I found:

<!--Open Button--><ribbon:Button Label="Open" 
                               ImageSourceSmall="/MyApp;component/Images\Open.ico"  
                               KeyTipAccessText="O" 
                               Command="{x:Static module:ModuleCommands.OpenFileCommand}"
                               CommandParameter=" "/>

 And in my function, I use IsNullOrWhiteSpace to trigger the opening of the Open File Dialog.

However, I would like to avoid doing this, I am sure there is a way to handle DelegateCommand(Of String) properly?

Thanks


Viewing all articles
Browse latest Browse all 1458

Trending Articles