Mesen2/UI/Controls/MesenSlider.axaml
2023-01-25 16:03:56 -05:00

77 lines
No EOL
2.9 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="34"
x:Name="root"
HorizontalAlignment="Stretch"
x:Class="Mesen.Controls.MesenSlider"
>
<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] DockPanel TextBox">
<Setter Property="DockPanel.Dock" Value="Right" />
<Setter Property="Margin" Value="2 -15 2 0" />
<Setter Property="MinWidth" Value="26" />
<Setter Property="MinHeight" Value="17" />
<Setter Property="Height" Value="17" />
</Style>
<Style Selector="c|MesenSlider DockPanel > TextBlock">
<Setter Property="DockPanel.Dock" Value="Bottom" />
<Setter Property="Margin" Value="0" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] DockPanel > TextBlock">
<Setter Property="DockPanel.Dock" Value="Top" />
<Setter Property="Margin" Value="0 0 0 2" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] DockPanel > TextBlock.visibleText">
<Setter Property="Margin" Value="0 0 0 5" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal]">
<Setter Property="Height" Value="34" />
</Style>
<Style Selector="c|MesenSlider[Orientation=Horizontal] Slider">
<Setter Property="Margin" Value="0 -25 0 0" />
</Style>
</UserControl.Styles>
<Panel HorizontalAlignment="Stretch">
<DockPanel>
<TextBlock
Classes.visibleText="{CompiledBinding Text.Length, ElementName=root}"
Text="{CompiledBinding Text, ElementName=root}"
/>
<c:MesenNumericTextBox
Min="{CompiledBinding Minimum, ElementName=root}"
Max="{CompiledBinding Maximum, ElementName=root}"
Value="{CompiledBinding Value, ElementName=root}"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
IsVisible="{CompiledBinding !HideValue, ElementName=root}"
/>
<Slider
Minimum="{CompiledBinding Minimum, ElementName=root}"
Maximum="{CompiledBinding Maximum, ElementName=root}"
Orientation="{CompiledBinding Orientation, ElementName=root}"
Value="{CompiledBinding Value, ElementName=root, Mode=TwoWay}"
TickPlacement="BottomRight"
TickFrequency="{CompiledBinding TickFrequency, ElementName=root}"
PropertyChanged="Slider_OnPropertyChanged"
LargeChange="5"
SmallChange="1"
/>
</DockPanel>
</Panel>
</UserControl>