Hi everybody,
I'm encountering problems with a RoutedCommand.
I have a RoutedCommand that looks like the following one (stored in a static class namedCommands) :
public static RoutedCommand MyRoutedCommand = new RoutedCommand(); public static void SaveFile(object sender, ExecutedRoutedEventArgs e) { var dgSave = new Microsoft.Win32.SaveFileDialog(); dgSave.Filter = "Google Maps Files (*.kml)|*.kml|All files (*.*)|*.*"; dgSave.ShowDialog(); // ??? What do I have to write here ? }
In my XAML file, I have a Button beside a TextBox :
<TextBox x:Name="tboxFullPathFile" Width="300"/><Button x:Name="btBrowse" Content="Browse ..." Margin="5,0" Command="{x:Static Member=m:Commands.MyRoutedCommand}" CommandTarget="{Binding ElementName=tboxFullPathFile, Path=Text}"/>
In my XAML .cs file, I added the following line :
CommandBindings.Add(new CommandBinding(Commands.MyRoutedCommand, Commands.SaveFile));
I would like the tboxFullPathFile to be filled with the path selected in the functionSave. But I don't know how I have to do and I can't use CommandParamter (I planned to use it to do other things).
Do you have an idea ?
Thanks in advance for your help.