Mega Code Archive

 
Categories / VB.Net Tutorial / WPF
 

Suppress Keyboard and Mouse Events

<Window x: Class="WpfApplication1.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="WPF " Height="100" Width="200">     <StackPanel Orientation="Horizontal">         <StackPanel Orientation="Horizontal" PreviewMouseDown="StackPanel_PreviewMouseDown">             <Button Content="Blocked" Click="Button_Click" Height="25" Margin="10" Width="70"/>         </StackPanel>         <Button Content="Not Blocked" Click="Button_Click" Height="25" Margin="10" Width="70"/>     </StackPanel> </Window> //File:Window.xaml.vb Imports System.Windows Imports System.Windows.Input Namespace WpfApplication1   Public Partial Class Window1     Inherits Window     Public Sub New()       InitializeComponent()     End Sub     Private Sub Button_Click(sender As Object, e As RoutedEventArgs)       MessageBox.Show("Button Clicked", "Button")     End Sub     Private Sub StackPanel_PreviewMouseDown(sender As Object, e As MouseButtonEventArgs)       e.Handled = True     End Sub   End Class End Namespace