Mesen2/UI/Controls/MesenSlider.axaml
Sour d208fdc6a7 UI: Support for NativeAOT
Added Windows & Linux builds using AOT compilation
2024-06-05 20:23:31 +09:00

96 lines
No EOL
3.5 KiB
XML

<UserControl
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"
xmlns:c="using:Mesen.Controls"
mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="400"
x:Name="root"
x:Class="Mesen.Controls.MesenSlider"
HorizontalAlignment="Stretch"
>
<UserControl.Styles>
<Style Selector="c|MesenSlider[Orientation=Vertical] DockPanel TextBox">
<Setter Property="DockPanel.Dock" Value="Bottom" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Vertical] > Panel > Panel">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] > Panel > DockPanel">
<Setter Property="Margin" Value="0 11 0 0" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Vertical] DockPanel > Slider">
<Setter Property="Margin" Value="12 0 0 0" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] > Panel">
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Vertical] > Panel">
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] DockPanel > TextBox">
<Setter Property="DockPanel.Dock" Value="Right" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Margin" Value="2 0 2 0" />
<Setter Property="MinWidth" Value="32" />
<Setter Property="MinHeight" Value="18" />
<Setter Property="Height" Value="18" />
</Style>
<Style Selector="c|MesenSlider TextBlock.HorizontalText, c|MesenSlider TextBlock.VerticalText">
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] TextBlock.HorizontalText">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Vertical] TextBlock.VerticalText">
<Setter Property="IsVisible" Value="True" />
<Setter Property="TextAlignment" Value="Center" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal]">
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] Slider">
<Setter Property="Margin" Value="0 0 0 0" />
</Style>
</UserControl.Styles>
<Panel>
<DockPanel Classes.visibleText="{Binding Text.Length, ElementName=root}">
<TextBlock
DockPanel.Dock="Bottom"
Classes="VerticalText"
Text="{Binding Text, ElementName=root}"
/>
<c:MesenNumericTextBox
Min="{Binding Minimum, ElementName=root}"
Max="{Binding Maximum, ElementName=root}"
Value="{Binding Value, ElementName=root}"
HorizontalContentAlignment="Center"
IsVisible="{Binding !HideValue, ElementName=root}"
/>
<Slider
Minimum="{Binding Minimum, ElementName=root}"
Maximum="{Binding Maximum, ElementName=root}"
Orientation="{Binding Orientation, ElementName=root}"
Value="{Binding Value, ElementName=root, Mode=TwoWay}"
TickPlacement="BottomRight"
TickFrequency="{Binding TickFrequency, ElementName=root}"
PropertyChanged="Slider_OnPropertyChanged"
LargeChange="5"
SmallChange="1"
/>
</DockPanel>
<TextBlock
Classes="HorizontalText"
Text="{Binding Text, ElementName=root}"
/>
</Panel>
</UserControl>