public void enableLink(SymLink link) { MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler( delegate(object sender, System.Windows.Input.MouseButtonEventArgs args) { try { NavigateTo(link.filename, link.line, link.column); } catch { } }); MouseEnter += new System.Windows.Input.MouseEventHandler( delegate(object sender, System.Windows.Input.MouseEventArgs args) { TextDecorations.Add(System.Windows.TextDecorations.Underline); }); MouseLeave += new System.Windows.Input.MouseEventHandler( delegate(object sender, System.Windows.Input.MouseEventArgs args) { foreach (var td in System.Windows.TextDecorations.Underline) { TextDecorations.Remove(td); } }); }
public SpellingOptions(string text, IDialogElement element, IEnumerable <string> corrections = null, Action <object, PropertyChangedEventArgs> changedCallback = null) : base(text, element, changedCallback) { m_element = element; TextDecoration decoration = new TextDecoration(TextDecorationLocation.Underline, s_underline, 0, TextDecorationUnit.FontRecommended, TextDecorationUnit.FontRecommended); TextDecorations.Add(decoration); m_menu = new ContextMenu(); m_menu.Placement = PlacementMode.MousePoint; if (corrections != null) { DelegateCommand <string> replaceTextCmd = new DelegateCommand <string>(ReplaceText); foreach (string correction in corrections) { m_menu.Items.Add(new MenuItem { Header = correction, Command = replaceTextCmd, CommandParameter = correction, }); } m_menu.Items.Add(new Separator()); } m_menu.Items.Add(new MenuItem { Header = $"Add \"{text}\" to dictionary", Command = new DelegateCommand(AddToDictionary) }); }
public UnderlineClassificationFormatDefinition() { DisplayName = "Gd Underline"; var underline = new System.Windows.TextDecoration { PenThicknessUnit = System.Windows.TextDecorationUnit.FontRecommended }; if (TextDecorations == null) { TextDecorations = new System.Windows.TextDecorationCollection(); } TextDecorations.Add(underline); }
public HyperlinkTextBlock() { Theme.Initialize(); BRUSH_HOVER = ThemeColours.Background_Brush_Blue_VeryDark; BRUSH_LIGHT = ThemeColours.Background_Brush_Blue_VeryVeryVeryDark; TextDecorations.Add(System.Windows.TextDecorations.Underline); Cursor = Cursors.Hand; Foreground = BRUSH_LIGHT; MouseEnter += HyperlinkTextBlock_MouseEnter; MouseLeave += HyperlinkTextBlock_MouseLeave; MouseLeftButtonDown += HyperlinkTextBlock_MouseLeftButtonDown; MouseLeftButtonUp += HyperlinkTextBlock_MouseLeftButtonUp; }
public void enableLink() { MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler( delegate(object sender, System.Windows.Input.MouseButtonEventArgs args) { // Text = "clicked!"; }); MouseEnter += new System.Windows.Input.MouseEventHandler( delegate(object sender, System.Windows.Input.MouseEventArgs args) { TextDecorations.Add(System.Windows.TextDecorations.Underline); }); MouseLeave += new System.Windows.Input.MouseEventHandler( delegate(object sender, System.Windows.Input.MouseEventArgs args) { foreach (var td in System.Windows.TextDecorations.Underline) { TextDecorations.Remove(td); } }); }