TProPCMonitor/LoraGamepad/Views/TProView.axaml

98 lines
5.3 KiB
Plaintext
Raw Normal View History

2022-11-06 14:49:30 +08:00
<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"
2022-11-06 18:44:23 +08:00
xmlns:viewModels="clr-namespace:LoraGamepad.ViewModels"
xmlns:eventBinder="clr-namespace:EventBinder;assembly=EventBinder.Avalonia"
2022-11-06 15:59:20 +08:00
mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="400"
2022-11-06 14:49:30 +08:00
x:Class="LoraGamepad.Views.TProView">
2022-11-06 18:44:23 +08:00
<UserControl.DataContext>
<viewModels:TProViewModel/>
</UserControl.DataContext>
<!-- 样式设置 -->
<UserControl.Styles>
<Style Selector="Button.open">
<Setter Property="Background" Value="{DynamicResource DarkBlueBrush}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="18"/>
</Style>
<Style Selector="Button.close">
<Setter Property="Background" Value="{DynamicResource DarkRedBrush}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="18"/>
</Style>
<Style Selector="Button.open:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource BrightBlueBrush}"/>
<Setter Property="TextBlock.Foreground" Value="White"/>
</Style>
<Style Selector="Button.close:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource BrightRedBrush}"/>
<Setter Property="TextBlock.Foreground" Value="White"/>
</Style>
2022-11-08 17:37:39 +08:00
<Style Selector="Slider">
<Setter Property="TickFrequency" Value="10"/>
<Setter Property="TickPlacement" Value="BottomRight"/>
<Setter Property="Maximum" Value="100"/>
<Setter Property="Minimum" Value="-100"/>
</Style>
2022-11-06 18:44:23 +08:00
</UserControl.Styles>
<!-- 页面布局 -->
2022-11-06 15:59:20 +08:00
<Grid RowDefinitions="60,*,40,2*">
2022-11-06 18:44:23 +08:00
<Grid Grid.Row="0" Background="Blue" ColumnDefinitions="*,2*,2*,*">
<Slider Grid.Column="0" Width="80" HorizontalAlignment="Center"/>
<ComboBox Grid.Column="1" SelectedIndex="0" VerticalAlignment="Center" Width="120" HorizontalAlignment="Right" Margin="10,0"
Items="{Binding PortList}"
SelectedItem="{Binding PortSelectItem}"
PointerPressed="{eventBinder:EventBinding OnPortListComboBoxPressed}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock FontSize="18" Foreground="White" Text="{Binding PortName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Grid.Column="2" Classes="open" Command="{Binding OpenPort}" IsVisible="{Binding IsOpenPortButtonVisible}"
HorizontalAlignment="Left" Margin="0,0,10,0" Content="打开串口" HorizontalContentAlignment="Center" Width="100"
Name="BtnPortOpen">
</Button>
<Button Grid.Column="2" Classes="close" Command="{Binding ClosePort}" IsVisible="{Binding IsClosePortButtonVisible}"
HorizontalAlignment="Left" Margin="0,0,10,0" Content="关闭串口" HorizontalContentAlignment="Center" Width="100"
Name="BtnPortClose">
</Button>
<Button Grid.Column="3" Width="100" Height="40"/>
2022-11-06 15:59:20 +08:00
</Grid>
<Grid Grid.Row="1" Background="Gray" ColumnDefinitions="2*,*,4*,*,2*">
2022-11-06 18:44:23 +08:00
<Button Grid.Column="0" Width="80" Height="60" HorizontalAlignment="Center"/>
<Slider Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center"/>
<Slider Grid.Column="3" Orientation="Vertical" HorizontalAlignment="Center"/>
<Button Grid.Column="4" Width="80" Height="60" HorizontalAlignment="Center"/>
2022-11-06 15:59:20 +08:00
</Grid>
<Grid Grid.Row="2" Background="Yellow">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Width="40" Margin="10"/>
<Button Width="40" Margin="10"/>
<Button Width="40" Margin="10"/>
<Button Width="40" Margin="10"/>
<Button Width="40" Margin="10"/>
<Button Width="40" Margin="10"/>
</StackPanel>
</Grid>
<Grid Grid.Row="3" Background="Green" ColumnDefinitions="*,2*,*">
<Grid Grid.Column="0">
2022-11-08 17:37:39 +08:00
<Slider VerticalAlignment="Center"
Value="{Binding SliderValue.LeftVerticalValue}"/>
<Slider Orientation="Vertical" HorizontalAlignment="Center"
Value="{Binding SliderValue.LeftHorizonValue}"/>
2022-11-06 15:59:20 +08:00
</Grid>
<Grid Grid.Column="1" Background="Purple">
<TextBox Text="Hello T-Pro!"/>
</Grid>
<Grid Grid.Column="2">
2022-11-08 17:37:39 +08:00
<Slider VerticalAlignment="Center"
Value="{Binding SliderValue.RightHorizonValue}"/>
<Slider Orientation="Vertical" HorizontalAlignment="Center"
Value="{Binding SliderValue.RightVerticalValue}"/>
2022-11-06 15:59:20 +08:00
</Grid>
</Grid>
</Grid>
2022-11-06 14:49:30 +08:00
</UserControl>