ImageButton & ImageSplitButton
This commit is contained in:
25
Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml
Normal file
25
Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<Button 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="Pilz.UI.AvaloniaUI.Controls.ImageButton">
|
||||
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="6"
|
||||
>
|
||||
<Image
|
||||
VerticalAlignment="Center"
|
||||
Width="16"
|
||||
Height="16"
|
||||
x:Name="ButtonImage"
|
||||
/>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ButtonText"
|
||||
/>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
55
Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml.cs
Normal file
55
Pilz.UI.AvaloniaUI/Controls/ImageButton.axaml.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Pilz.UI.AvaloniaUI.Controls;
|
||||
|
||||
public partial class ImageButton : Button
|
||||
{
|
||||
protected override Type StyleKeyOverride => typeof(Button);
|
||||
|
||||
public ImageButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string? Text
|
||||
{
|
||||
get => ButtonText.Text;
|
||||
set => ButtonText.Text = value;
|
||||
}
|
||||
|
||||
public IImage? ImageSource
|
||||
{
|
||||
get => ButtonImage.Source;
|
||||
set => ButtonImage.Source = value;
|
||||
}
|
||||
|
||||
public double ImageWidth
|
||||
{
|
||||
get => ButtonImage.Width;
|
||||
set => ButtonImage.Width = value;
|
||||
}
|
||||
|
||||
public double ImageHeight
|
||||
{
|
||||
get => ButtonImage.Height;
|
||||
set => ButtonImage.Height = value;
|
||||
}
|
||||
|
||||
public double ImageQuadSize
|
||||
{
|
||||
get => ButtonImage.Width;
|
||||
set => ButtonImage.Width = ButtonImage.Height = value;
|
||||
}
|
||||
|
||||
public Size ImageSize
|
||||
{
|
||||
get => new(ButtonImage.Width, ButtonImage.Height);
|
||||
set
|
||||
{
|
||||
ButtonImage.Width = value.Width;
|
||||
ButtonImage.Height = value.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml
Normal file
25
Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<SplitButton 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="Pilz.UI.AvaloniaUI.Controls.ImageSplitButton">
|
||||
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="6"
|
||||
>
|
||||
<Image
|
||||
VerticalAlignment="Center"
|
||||
Width="16"
|
||||
Height="16"
|
||||
x:Name="ButtonImage"
|
||||
/>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ButtonText"
|
||||
/>
|
||||
</StackPanel>
|
||||
</SplitButton>
|
||||
55
Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml.cs
Normal file
55
Pilz.UI.AvaloniaUI/Controls/ImageSplitButton.axaml.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace Pilz.UI.AvaloniaUI.Controls;
|
||||
|
||||
public partial class ImageSplitButton : SplitButton
|
||||
{
|
||||
protected override Type StyleKeyOverride => typeof(SplitButton);
|
||||
|
||||
public ImageSplitButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string? Text
|
||||
{
|
||||
get => ButtonText.Text;
|
||||
set => ButtonText.Text = value;
|
||||
}
|
||||
|
||||
public IImage? ImageSource
|
||||
{
|
||||
get => ButtonImage.Source;
|
||||
set => ButtonImage.Source = value;
|
||||
}
|
||||
|
||||
public double ImageWidth
|
||||
{
|
||||
get => ButtonImage.Width;
|
||||
set => ButtonImage.Width = value;
|
||||
}
|
||||
|
||||
public double ImageHeight
|
||||
{
|
||||
get => ButtonImage.Height;
|
||||
set => ButtonImage.Height = value;
|
||||
}
|
||||
|
||||
public double ImageQuadSize
|
||||
{
|
||||
get => ButtonImage.Width;
|
||||
set => ButtonImage.Width = ButtonImage.Height = value;
|
||||
}
|
||||
|
||||
public Size ImageSize
|
||||
{
|
||||
get => new(ButtonImage.Width, ButtonImage.Height);
|
||||
set
|
||||
{
|
||||
ButtonImage.Width = value.Width;
|
||||
ButtonImage.Height = value.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Pilz.UI.AvaloniaUI/Controls/_XmlnsDefinitions.cs
Normal file
3
Pilz.UI.AvaloniaUI/Controls/_XmlnsDefinitions.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
using Avalonia.Metadata;
|
||||
|
||||
[assembly: XmlnsDefinition("https://git.pilzinsel64.de/pilz-framework/pilz", "Pilz.UI.AvaloniaUI.Controls")]
|
||||
Reference in New Issue
Block a user