Mini Kabibi Habibi
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DevExpress.Xpf.Bars;
using DevExpress.XtraRichEdit;
using System.Collections;
using System.Windows.Markup;
using DevExpress.Xpf.Core;
using DevExpress.Xpf.Utils;
namespace BarsDemo {
public partial class ContextMenu: BarsDemoModule {
public ButtonSwitcher MenuButton {
get { return (ButtonSwitcher)GetValue(MenuButtonProperty); }
set { SetValue(MenuButtonProperty, value); }
}
public static readonly DependencyProperty MenuButtonProperty =
DependencyPropertyManager.Register("MenuButton", typeof(ButtonSwitcher), typeof(ContextMenu), new FrameworkPropertyMetadata());
public ContextMenu() {
InitializeComponent();
edit.Text = "Right click here to show the context menu";
CheckMouseSwitcher();
edit.ContextMenu = null;
}
protected virtual void bCut_ItemClick(object sender, ItemClickEventArgs e) {
edit.Cut();
}
protected virtual void bCopy_ItemClick(object sender, ItemClickEventArgs e) {
edit.Copy();
}
protected virtual void bPaste_ItemClick(object sender, ItemClickEventArgs e) {
edit.Paste();
}
protected virtual void bClear_ItemClick(object sender, ItemClickEventArgs e) {
edit.Clear();
}
protected virtual void bSelectAll_ItemClick(object sender, ItemClickEventArgs e) {
edit.SelectAll();
}
private void OnRadioButtonClick(object sender, RoutedEventArgs e) {
CheckMouseSwitcher();
}
private void CheckMouseSwitcher() {
if((bool)Left.IsChecked)
MenuButton = ButtonSwitcher.LeftButton;
if((bool)LeftRight.IsChecked)
MenuButton = ButtonSwitcher.LeftRightButton;
if((bool)Right.IsChecked)
MenuButton = ButtonSwitcher.RightButton;
UpdateText(MenuButton);
}
private void UpdateText(ButtonSwitcher MenuButton) {
string text = string.Empty;
switch(MenuButton) {
case ButtonSwitcher.LeftButton:
text = "Left click here to show the context menu";
break;
case ButtonSwitcher.LeftRightButton:
text = "Left or right click here to show the context menu";
break;
case ButtonSwitcher.RightButton:
text = "Right click here to show the context menu";
break;
}
edit.Clear();
edit.Text = text;
}
}
}