-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
64 lines (60 loc) · 3.34 KB
/
MainWindow.xaml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<Window x:Class="MonitorControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:MonitorControl"
mc:Ignorable="d"
Title="Monitor Control"
MinHeight="200" MinWidth="200" SizeToContent="WidthAndHeight" ResizeMode="NoResize"
MaxWidth="650"
Loaded="Window_Loaded"
>
<ListBox x:Name="MonitorList" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionMode="Single">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<ContentPresenter/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="160" Width="180" Margin="5" >
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition />
</Grid.RowDefinitions>
<Border BorderThickness="1" CornerRadius="3" Grid.RowSpan="2" BorderBrush="{DynamicResource {x:Static SystemColors.ScrollBarBrushKey}}" />
<Grid Grid.Row="0">
<TextBlock Text="{Binding DeviceName}" TextWrapping="Wrap" Grid.RowSpan="2" HorizontalAlignment="Center" Margin="0,10,0,0" >
</TextBlock>
<Rectangle HorizontalAlignment="Center" Margin="0,35,0,0" VerticalAlignment="Top"
Width="{Binding DisplayWidth}" Height="53">
<Rectangle.Stroke>
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}"/>
</Rectangle.Stroke>
</Rectangle>
</Grid>
<Grid Grid.Row="1" IsEnabled="{Binding IsEnabled}">
<Slider HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="116" Height="24"
Maximum="100" SmallChange="1" TickPlacement="TopLeft" TickFrequency="25" IsMoveToPointEnabled="True"
Value="{Binding BrightnessLevel, Mode=OneWay}" ValueChanged="Slider_ValueChanged" />
<Button HorizontalAlignment="Right" VerticalAlignment="Center"
Width="32" Height="32" Margin="0,0,10,0"
Content="{Binding PowerText, Mode=OneWay}" Click="Button_Click" />
</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Window>