79 lines
4.0 KiB
XML
79 lines
4.0 KiB
XML
<UserControl x:Class="ProcessManager.MenuView"
|
|
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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
xmlns:prism="http://prismlibrary.com/"
|
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:ProcessManager"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
|
|
|
<i:Interaction.Triggers>
|
|
<i:EventTrigger EventName="Loaded">
|
|
<i:InvokeCommandAction Command="{Binding WindowLoadedCommand}" />
|
|
</i:EventTrigger>
|
|
</i:Interaction.Triggers>
|
|
<Grid>
|
|
<ItemsControl ItemsSource="{Binding ConfigList}"
|
|
Grid.Row="1">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel IsItemsHost="True"
|
|
Orientation="Horizontal" />
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<materialDesign:Card Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
|
Width="220"
|
|
Margin="5"
|
|
Padding="8"
|
|
Height="230"
|
|
Background="DarkSlateGray"
|
|
Foreground="white">
|
|
|
|
<StackPanel>
|
|
<!-- 标题 -->
|
|
<TextBlock Margin="16,16,12,8"
|
|
FontSize="16"
|
|
Text="{Binding Title}" />
|
|
|
|
<!-- 设备列表自动生成对应 CheckBox -->
|
|
<ItemsControl ItemsSource="{Binding DeviceList}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<CheckBox Margin="16,4,16,0"
|
|
Content="{Binding DeviceName}"
|
|
IsChecked="{Binding IsEnabled,Mode=TwoWay}"
|
|
Style="{StaticResource MaterialDesignUserForegroundCheckBox}" />
|
|
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
|
|
<Separator Style="{StaticResource MaterialDesignLightSeparator}" />
|
|
|
|
</StackPanel>
|
|
|
|
<materialDesign:Card.ContextMenu>
|
|
<ContextMenu DataContext="{Binding RelativeSource={RelativeSource Self}, Path=PlacementTarget.Tag}">
|
|
<MenuItem Header="编辑"
|
|
Command="{Binding EditCommand}"
|
|
CommandParameter="{Binding PlacementTarget.DataContext.Title,
|
|
RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
|
|
<MenuItem Header="启动"
|
|
Command="{Binding StartCommand}"
|
|
CommandParameter="{Binding PlacementTarget.DataContext.Title,
|
|
RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
|
|
|
|
</ContextMenu>
|
|
</materialDesign:Card.ContextMenu>
|
|
</materialDesign:Card>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</Grid>
|
|
</UserControl>
|