Files
huehuehue/HueUWP/MainPage.xaml
T
2015-12-01 15:56:35 +01:00

58 lines
2.7 KiB
XML

<Page
x:Class="HueUWP.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HueUWP"
xmlns:convert="using:HueUWP.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
DataContext="{Binding LightsViewModel, RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Page.Resources>
<convert:NullableBooleanConverter x:Key="BoolConverter"/>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<RelativePanel Grid.Row="0">
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="24" Margin="20,10,0,0">Hue Lights</TextBlock>
<StackPanel Orientation="Horizontal" RelativePanel.AlignRightWithPanel="True">
<Button Name="SettingsButton" Click="SettingsButton_Click" FontFamily="Segoe MDL2 Assets" FontSize="18" Margin="10" Content="&#xE713;" />
<Button Name="RefreshButton" Click="RefreshButton_Click" FontFamily="Segoe MDL2 Assets" FontSize="18" Margin="10" Content="&#xE72C;" />
</StackPanel>
</RelativePanel>
<StackPanel Grid.Row="1" Margin="20,40,20,40">
<ListView x:Name="myListView" ItemsSource="{Binding}" IsItemClickEnabled="True" ItemClick="myListView_ItemClick">
<ListView.ItemTemplate>
<DataTemplate x:Name="dataTemplate">
<StackPanel Orientation="Horizontal">
<Rectangle Width="20" Height="20" Fill="{Binding Color}" Margin="20, 0,0,0" />
<StackPanel Orientation="Vertical" Width="200" Margin="20,0,0,0">
<TextBlock Text="{Binding Name}" FontSize="24" />
<TextBlock Text="{Binding Type}" FontSize="14" />
</StackPanel>
<ToggleSwitch Margin="40,0,0,0" Toggled="ToggleSwitch_Toggled" IsOn="{Binding IsOn, Converter={StaticResource BoolConverter}}">
<ToggleSwitch.OffContent>Off</ToggleSwitch.OffContent>
<ToggleSwitch.OnContent>On</ToggleSwitch.OnContent>
</ToggleSwitch>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Grid>
</Page>