private static void OnHyperlinkClicked(Windows.UI.Xaml.Documents.Hyperlink sender, Windows.UI.Xaml.Documents.HyperlinkClickEventArgs args) { ICommand command = GetCommand(sender); object parameter = GetCommandParameter(sender); command?.Execute(parameter); }
public override Inline ConvertToInline() { var s = new Windows.UI.Xaml.Documents.Hyperlink(); s.Click += (sender, args) => { OnClick(); }; bool donefirst = false; foreach (var n in Nodes) { if (Pad && donefirst) { s.Inlines.Add(new Windows.UI.Xaml.Documents.Run { Text = " " }); } s.Inlines.Add(n.ConvertToInline()); donefirst = true; } #if WINDOWS_UWP return(ApplyStyles(s)); #else var u = new Underline(); u.Inlines.Add(s); return(ApplyStyles(u)); #endif }
private static void OnCommandPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { Windows.UI.Xaml.Documents.Hyperlink hyperlink = sender as Windows.UI.Xaml.Documents.Hyperlink; if (hyperlink != null) { hyperlink.Click -= OnHyperlinkClicked; ICommand command = args.NewValue as ICommand; if (command != null) { hyperlink.Click += OnHyperlinkClicked; } } }
public static Xaml.Hyperlink Control(this Trainer.Domain.HyperLink item, bool isThumbnail = false) { var control = new Xaml.Hyperlink { NavigateUri = new Uri(item.NavigateUri) }; var run = new Xaml.Run { Text = item.Value }; if (isThumbnail) { run.FontSize = ThumbnailFontSize; } control.Inlines.Add(run); return(control); }
/// <summary> /// Sets the <see cref="CommandProperty"/> assocaited with the specified <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> /// </summary> /// <param name="obj">The <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> to associated the <see cref="CommandProperty"/> instance to</param> /// <param name="value">The <see cref="object"/> to set the <see cref="CommandProperty"/> to</param> public static void SetCommandParameter(Windows.UI.Xaml.Documents.Hyperlink obj, object value) { obj.SetValue(CommandParameterProperty, value); }
/// <summary> /// Gets the <see cref="CommandProperty"/> instance assocaited with the specified <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> /// </summary> /// <param name="obj">The <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> from which to get the associated <see cref="CommandProperty"/> value</param> /// <returns>The <see cref="CommandProperty"/> value associated with the the <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> or null</returns> public static object GetCommandParameter(Windows.UI.Xaml.Documents.Hyperlink obj) { return(obj.GetValue(CommandParameterProperty)); }
/// <summary> /// Sets the <see cref="ICommand"/> instance assocaited with the specified <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> /// </summary> /// <param name="obj">The <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> to associated the <see cref="ICommand"/> instance to</param> /// <param name="value">The <see cref="ICommand"/> instance to bind to the <see cref="Windows.UI.Xaml.Documents.Hyperlink"/></param> public static void SetCommand(Windows.UI.Xaml.Documents.Hyperlink obj, ICommand value) { obj.SetValue(CommandProperty, value); }
/// <summary> /// Gets the <see cref="ICommand"/> instance assocaited with the specified <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> /// </summary> /// <param name="obj">The <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> from which to get the associated <see cref="ICommand"/> instance</param> /// <returns>The <see cref="ICommand"/> instance associated with the the <see cref="Windows.UI.Xaml.Documents.Hyperlink"/> or null</returns> public static ICommand GetCommand(Windows.UI.Xaml.Documents.Hyperlink obj) { return((ICommand)obj.GetValue(CommandProperty)); }
private void Hyperlink_Click(Windows.UI.Xaml.Documents.Hyperlink sender, Windows.UI.Xaml.Documents.HyperlinkClickEventArgs args) { var t = new Windows.UI.Popups.MessageDialog("Hyperlink clicked!").ShowAsync(); }