领胜LDS 键盘AOI检测项目
xcd
2020-06-24 d6c577e17ee7bb5331dd51d803f9b42441b0f0e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<UserControl x:Class="Bro.UI.Ctrls.DeviceStatusCtrl"
             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:local="clr-namespace:Bro.UI.Ctrls"
             xmlns:Converter="clr-namespace:Bro.UI.Converter"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Background="Transparent">
    <UserControl.Resources>
        <Converter:DeviceStateColorConvert x:Key="dscConvert"/>
        <Style TargetType="ListBox" x:Key="deviceStatusStyle">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid>
                            <Border BorderBrush="SteelBlue" BorderThickness="1" CornerRadius="5" Background="{Binding CurrentState,Converter={StaticResource dscConvert},Mode=OneWay}">
                                <TextBlock Margin="3" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center" Text="{Binding InitialConfig.Name}"/>
                            </Border>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                        <Setter Property="Background" Value="Transparent"/>
                        <Setter Property="BorderThickness" Value="0"/>
                    </Style>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid Background="Transparent">
        <ListBox Style="{StaticResource deviceStatusStyle}" x:Name="lbDevices" ScrollViewer.VerticalScrollBarVisibility="Hidden" BorderThickness="0" Background="Transparent"/>
    </Grid>
</UserControl>