mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
71 lines
3.6 KiB
XML
71 lines
3.6 KiB
XML
<UserControl x:Class="Artemis.UI.Shared.DraggableFloat"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:shared="clr-namespace:Artemis.UI.Shared"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
<UserControl.Style>
|
|
<Style TargetType="UserControl" >
|
|
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource MaterialDesignValidationErrorTemplate}" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=Self}, Path=IsEnabled}" Value="False">
|
|
<Setter Property="Opacity" Value="0.5" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</UserControl.Style>
|
|
<UserControl.Resources>
|
|
<Style TargetType="Rectangle" x:Key="RectStyle">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=IsEnabled}" Value="False">
|
|
<Setter Property="StrokeDashArray" Value="2 2" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</UserControl.Resources>
|
|
<Grid>
|
|
<!-- Drag handle -->
|
|
<Border x:Name="DragHandle" BorderThickness="0,0,0,1" Height="19">
|
|
<Border.BorderBrush>
|
|
<VisualBrush>
|
|
<VisualBrush.Visual>
|
|
<Rectangle x:Name="BorderVisual"
|
|
Style="{StaticResource RectStyle}"
|
|
Stroke="{DynamicResource MaterialDesignTextBoxBorder}"
|
|
StrokeThickness="1"
|
|
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
|
|
Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}">
|
|
</Rectangle>
|
|
</VisualBrush.Visual>
|
|
</VisualBrush>
|
|
</Border.BorderBrush>
|
|
<TextBlock Style="{x:Null}"
|
|
Width="60"
|
|
Height="17"
|
|
Padding="2 0"
|
|
Margin="0 3 0 0"
|
|
Text="{Binding InputValue, StringFormat=N3, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
|
|
Cursor="/Resources/Cursors/aero_drag_ew.cur"
|
|
MouseDown="InputMouseDown"
|
|
MouseUp="InputMouseUp"
|
|
MouseMove="InputMouseMove"
|
|
RequestBringIntoView="Input_OnRequestBringIntoView" />
|
|
</Border>
|
|
|
|
<!-- Input -->
|
|
<TextBox x:Name="DraggableFloatInputTextBox"
|
|
Width="60"
|
|
Height="21"
|
|
Padding="0 0 -2 0"
|
|
HorizontalAlignment="Left"
|
|
Text="{Binding InputValue, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
|
|
LostFocus="InputLostFocus"
|
|
KeyDown="InputKeyDown"
|
|
Visibility="Collapsed"
|
|
RequestBringIntoView="Input_OnRequestBringIntoView"
|
|
PreviewTextInput="Input_PreviewTextInput"
|
|
DataObject.Pasting="Input_OnPasting"/>
|
|
</Grid>
|
|
</UserControl> |