Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports DevExpress.Xpf.Bars
Imports DevExpress.XtraRichEdit
Imports System.Collections
Imports System.Windows.Markup
Imports DevExpress.Xpf.Core
Imports DevExpress.Xpf.Utils
Namespace BarsDemo
Partial Public Class ContextMenu
Inherits BarsDemoModule
Public Property MenuButton() As ButtonSwitcher
Get
Return CType(GetValue(MenuButtonProperty), ButtonSwitcher)
End Get
Set(ByVal value As ButtonSwitcher)
SetValue(MenuButtonProperty, value)
End Set
End Property
Public Shared ReadOnly MenuButtonProperty As DependencyProperty = DependencyPropertyManager.Register("MenuButton", GetType(ButtonSwitcher), GetType(ContextMenu), New FrameworkPropertyMetadata())
Public Sub New()
InitializeComponent()
edit.Text = "Right click here to show the context menu"
CheckMouseSwitcher()
edit.ContextMenu = Nothing
End Sub
Protected Overridable Sub bCut_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
edit.Cut()
End Sub
Protected Overridable Sub bCopy_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
edit.Copy()
End Sub
Protected Overridable Sub bPaste_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
edit.Paste()
End Sub
Protected Overridable Sub bClear_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
edit.Clear()
End Sub
Protected Overridable Sub bSelectAll_ItemClick(ByVal sender As Object, ByVal e As ItemClickEventArgs)
edit.SelectAll()
End Sub
Private Sub OnRadioButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
CheckMouseSwitcher()
End Sub
Private Sub CheckMouseSwitcher()
If CBool(Left.IsChecked) Then
MenuButton = ButtonSwitcher.LeftButton
End If
If CBool(LeftRight.IsChecked) Then
MenuButton = ButtonSwitcher.LeftRightButton
End If
If CBool(Right.IsChecked) Then
MenuButton = ButtonSwitcher.RightButton
End If
UpdateText(MenuButton)
End Sub
Private Sub UpdateText(ByVal MenuButton As ButtonSwitcher)
Dim text As String = String.Empty
Select Case MenuButton
Case ButtonSwitcher.LeftButton
text = "Left click here to show the context menu"
Case ButtonSwitcher.LeftRightButton
text = "Left or right click here to show the context menu"
Case ButtonSwitcher.RightButton
text = "Right click here to show the context menu"
End Select
edit.Clear()
edit.Text = text
End Sub
End Class
End Namespace