Files
huehuehue/HueUWP/MainPage.xaml
T

76 lines
3.3 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="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<RelativePanel Grid.Row="0">
<TextBlock RelativePanel.AlignLeftWithPanel="True" FontSize="24" Margin="20,10,0,0">Hue Lights</TextBlock>
</RelativePanel>
<RelativePanel Grid.Row="1" Visibility="Visible" Name="FeedbackPanel">
<ProgressRing Height="60" Width="60" RelativePanel.AlignHorizontalCenterWithPanel="True" Margin=" 0,10,0,10" IsActive="True" Name="Loading" />
<TextBlock RelativePanel.AlignLeftWithPanel="True" Name="ErrorMessage" Margin="20,10,0,10"/>
</RelativePanel>
<RelativePanel Grid.Row="2" Margin="0,10,0,0" Name="LightListPanel">
<ScrollViewer RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignTopWithPanel="True">
<ListView x:Name="myListView" ItemsSource="{Binding}" IsItemClickEnabled="True" ItemClick="myListView_ItemClick" >
<ListView.ItemTemplate>
<DataTemplate x:Name="dataTemplate">
<StackPanel Orientation="Horizontal">
<Rectangle Width="30" Height="30" Fill="{Binding Color}" Margin="20,0,0,0" />
<StackPanel Orientation="Vertical" Width="140" Margin="10,0,0,0">
<TextBlock Text="{Binding Name}" FontSize="24" />
<TextBlock Text="{Binding Type}" FontSize="14" />
</StackPanel>
<ToggleSwitch Margin="10,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>
</ScrollViewer>
</RelativePanel>
</Grid>
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Icon="Setting" Label="Settings" Click="SettingsButton_Click"/>
<AppBarButton Icon="Refresh" Label="Refresh" Click="RefreshButton_Click"/>
<AppBarSeparator/>
<CommandBar.SecondaryCommands>
<AppBarButton Label="About" Click="AboutButton_Click"/>
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
</Page>