This commit is contained in:
Yorick Rommers
2015-12-01 12:44:33 +01:00
3 changed files with 62 additions and 41 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
x:Class="HueUWP.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindingToCommandsUWP"
xmlns:local="using:HueUWP"
RequestedTheme="Light">
</Application>
+51 -40
View File
@@ -1,41 +1,52 @@
<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: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">
<Grid>
<StackPanel Margin="20,40,20,40">
<ListView x:Name="myListView" ItemsSource="{Binding}" >
<ListView.ItemTemplate>
<DataTemplate x:Name="dataTemplate">
<StackPanel Orientation="Horizontal">
<Rectangle Width="20" Height="20" Fill="Red" Margin="20, 0,0,0" />
<StackPanel Orientation="Vertical" Width="110" Margin="0,0,0,20">
<TextBlock Text="{Binding Name}" FontSize="24" />
<TextBlock Text="{Binding Type}" FontSize="14" />
</StackPanel>
<ToggleSwitch Toggled="ToggleSwitch_Toggled" >
<ToggleSwitch.OffContent>Off</ToggleSwitch.OffContent>
<ToggleSwitch.OnContent>On</ToggleSwitch.OnContent>
</ToggleSwitch>
<Slider x:Name="slider" Maximum="255" Minimum="0" Width="100" ValueChanged="slider_ValueChanged" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
<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: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">
<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="RegisterButton" Click="RegisterButton_Click" FontFamily="Segoe MDL2 Assets" FontSize="18" Margin="10" Content="&#xE71B;" />
<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}" >
<ListView.ItemTemplate>
<DataTemplate x:Name="dataTemplate">
<StackPanel Orientation="Horizontal">
<Rectangle Width="20" Height="20" Fill="Red" 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}">
<ToggleSwitch.OffContent>Off</ToggleSwitch.OffContent>
<ToggleSwitch.OnContent>On</ToggleSwitch.OnContent>
</ToggleSwitch>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Grid>
</Page>
</StackPanel>
</Grid>
</Page>
+10
View File
@@ -81,5 +81,15 @@ namespace HueUWP
Light l = (Light)slider.DataContext;
l.UpdateColor((int)slider.Value, 255, 255);
}
private void RegisterButton_Click(object sender, RoutedEventArgs e)
{
}
private void RefreshButton_Click(object sender, RoutedEventArgs e)
{
}
}
}