Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

CommandBinding doesn't work

$
0
0

hi,

Just trying to call a Command from one MenuItem:

XAML:

<Window.CommandBindings><CommandBinding Command="ApplicationCommands.Close" Executed="OnClose"/></Window.CommandBindings><MenuItem Name="Contextual_Salir" Header="Salir" Visibility="Visible"  Command="ApplicationCommands.Close"><MenuItem.Icon><Image Source="/Imagenes/Mapa_de_procesos.png" Height="20" Width="20"/></MenuItem.Icon></MenuItem>

code-behind:

 Private Sub OnClose(sender As Object, e As ExecutedRoutedEventArgs)
        Application.Current.Shutdown()
    End Sub

But the option ("Salir" in this case appears disabled... have not idea why!!


Primary platform is Windows 7 Ultimate 64 bit along with VS 2012/Sql2k8 for WPF and SilverLight stuff


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>