MenuItem RibbonCommand problem

May 31, 2010 at 10:05 AM
1 vote
MenuItem Command problem Title is required


Hi guys,
i use the fluent ribbon in VS 2008 (3.5). As you can see in the attachment, I Created a splitbutton (Save) with inside a MenuItem for SaveAs. This MenuItem has a Command associate (ICommand type) and when the Action command is executed i sent an Event to my application. In another class i subscribe that event and i do the "save as" creating a SaveFileDialog. The problem is the SaveFileDialog is created and showed but destroyed immediately before i can do something. I do something similar from a normal button on the Ribbon or from the "BackstageItems" or in every other place in Ribbon, using same mechanism and all is fine.My question is, i do something wrong in splitbutton items usage and definitions?I can understand, it is strange because the function called are the same, the only difference is the MenuItem instead a Button, or more strange is i add my MenuItem at runtime to the "QuickAccessToolBar" it works fine!!
Please help me if is possible

PS Just a simple code
<r:SplitButton Text="{StaticResource SaveProjectButton}"


Command="{Binding Commands.SaveFileCommand}"

<r:MenuItem Text="{DynamicResource SaveProjectAsButton}"

Command="{Binding Commands.SaveAsFileCommand}"



Commands is Just a Property that contains command to have binding.
Jun 2, 2010 at 1:43 PM
Edited Jun 15, 2010 at 12:24 PM

I have exactly the same problem in VS2010, (4.0). If the command fired directly from the Splitbutton, the dialog opens and stays open. If it's fired from the MenuItem, the dialog immediately closes with DialogResult = False. Here's my XAML:

<Fluent:SplitButton Text="Bookmark" Icon="Images\Bookmark_S.png" LargeIcon="Images\Bookmark_L.png" Click="mnuAddBookmark_Click" >  
    <Fluent:MenuItem Name="mnuAddBookmark" Text="Add" Click="mnuAddBookmark_Click" /> 

 and the code behind:

private void mnuAddBookmark_Click(object sender, RoutedEventArgs e) 
    Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
    dlg.Filter = "Plan-G Bookmarks (*.bmk)|*.bmk";
    dlg.InitialDirectory = System.IO.Path.GetDirectoryName(_executablePath) + "\\Bookmarks";
    dlg.RestoreDirectory = true;
    if (dlg.ShowDialog() == true)
        App.LogLine("Add Bookmark " + dlg.FileName); 

Jun 15, 2010 at 12:26 PM

Any news for a fix or workaround? This is a real problem for us, and there's been not even a comment in two weeks now.


Jun 15, 2010 at 12:54 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 15, 2010 at 2:15 PM

tim_a, just curious.. have you tried dlg.Owner = mainWindow;?
We will investigate it...

Jun 15, 2010 at 5:36 PM

That does the trick - thanks :-D

if (dlg.ShowDialog(this) == true)