Add LinkLabel control
This commit is contained in:
parent
6aa0a1f8b9
commit
17b0da358f
13
Source/LibationWinForms/AvaloniaUI/Controls/LinkLabel.axaml
Normal file
13
Source/LibationWinForms/AvaloniaUI/Controls/LinkLabel.axaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<TextBlock xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="LibationWinForms.AvaloniaUI.Controls.LinkLabel">
|
||||||
|
<TextBlock.Styles>
|
||||||
|
<Style Selector="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="Blue"/>
|
||||||
|
<Setter Property="TextDecorations" Value="Underline"/>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Styles>
|
||||||
|
</TextBlock>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Input;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
using Avalonia.Styling;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LibationWinForms.AvaloniaUI.Controls
|
||||||
|
{
|
||||||
|
public partial class LinkLabel : TextBlock, IStyleable
|
||||||
|
{
|
||||||
|
Type IStyleable.StyleKey => typeof(TextBlock);
|
||||||
|
private static readonly Cursor HandCursor = new Cursor(StandardCursorType.Hand);
|
||||||
|
public LinkLabel()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
protected override void OnPointerEnter(PointerEventArgs e)
|
||||||
|
{
|
||||||
|
this.Cursor = HandCursor;
|
||||||
|
base.OnPointerEnter(e);
|
||||||
|
}
|
||||||
|
protected override void OnPointerLeave(PointerEventArgs e)
|
||||||
|
{
|
||||||
|
this.Cursor = Cursor.Default;
|
||||||
|
base.OnPointerLeave(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,18 +23,13 @@
|
|||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
<Panel Grid.Column="0" Grid.Row="1">
|
<Panel Grid.Column="0" Grid.Row="1">
|
||||||
<Panel.Styles>
|
|
||||||
<Style Selector="TextBlock">
|
|
||||||
<Setter Property="Foreground" Value="Blue"/>
|
|
||||||
<Setter Property="FontSize" Value="14"/>
|
|
||||||
<Setter Property="TextDecorations" Value="Underline"/>
|
|
||||||
</Style>
|
|
||||||
</Panel.Styles>
|
|
||||||
|
|
||||||
<TextBlock
|
<controls:LinkLabel
|
||||||
Margin="10" TextWrapping="Wrap" TextAlignment="Center"
|
Margin="10"
|
||||||
Tapped="GoToAudible_Tapped"
|
TextWrapping="Wrap"
|
||||||
Text="Open in
Audible
(Browser)" />
|
TextAlignment="Center"
|
||||||
|
Tapped="GoToAudible_Tapped"
|
||||||
|
Text="Open in
Audible
(Browser)" />
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
<TextBox
|
<TextBox
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
MinWidth="350" MinHeight="200"
|
MinWidth="350" MinHeight="200"
|
||||||
Width="350" Height="200"
|
Width="350" Height="200"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
|
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
|
||||||
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.Login.LoginChoiceEagerDialog"
|
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.Login.LoginChoiceEagerDialog"
|
||||||
Title="Audible Login"
|
Title="Audible Login"
|
||||||
Icon="/AvaloniaUI/Assets/libation.ico" >
|
Icon="/AvaloniaUI/Assets/libation.ico" >
|
||||||
@ -51,9 +52,7 @@
|
|||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
VerticalAlignment="Bottom">
|
VerticalAlignment="Bottom">
|
||||||
|
|
||||||
<TextBlock
|
<controls:LinkLabel
|
||||||
Foreground="Blue"
|
|
||||||
TextDecorations="Underline"
|
|
||||||
Tapped="ExternalLoginLink_Tapped"
|
Tapped="ExternalLoginLink_Tapped"
|
||||||
Text="Or click here to log in with your browser." />
|
Text="Or click here to log in with your browser." />
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
MinWidth="600" MinHeight="450"
|
MinWidth="600" MinHeight="450"
|
||||||
MaxWidth="600" MaxHeight="450"
|
MaxWidth="600" MaxHeight="450"
|
||||||
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.MessageBoxAlertAdminDialog"
|
x:Class="LibationWinForms.AvaloniaUI.Views.Dialogs.MessageBoxAlertAdminDialog"
|
||||||
|
xmlns:controls="clr-namespace:LibationWinForms.AvaloniaUI.Controls"
|
||||||
Title="MessageBoxAlertAdminDialog"
|
Title="MessageBoxAlertAdminDialog"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
Icon="/AvaloniaUI/Assets/libation.ico">
|
Icon="/AvaloniaUI/Assets/libation.ico">
|
||||||
@ -47,16 +48,8 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
|
|
||||||
<StackPanel.Styles>
|
|
||||||
<Style Selector="TextBlock">
|
|
||||||
<Setter Property="Foreground" Value="Blue"/>
|
|
||||||
<Setter Property="FontSize" Value="14"/>
|
|
||||||
<Setter Property="TextDecorations" Value="Underline"/>
|
|
||||||
</Style>
|
|
||||||
</StackPanel.Styles>
|
|
||||||
|
|
||||||
<TextBlock
|
<controls:LinkLabel
|
||||||
Margin="10"
|
Margin="10"
|
||||||
Tapped="GoToGithub_Tapped"
|
Tapped="GoToGithub_Tapped"
|
||||||
Text="Click to go to github" />
|
Text="Click to go to github" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user