-
Notifications
You must be signed in to change notification settings - Fork 2
/
DemoLightsPage.xaml
83 lines (79 loc) · 4.13 KB
/
DemoLightsPage.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:DemoLights" x:Class="DemoLights.DemoLightsPage"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions" Title="Light" IsBusy="{Binding IsBusy}"
xmlns:iosCoreGraphics="clr-namespace:CoreGraphics;assembly=Xamarin.iOS;targetPlatform=iOS"
xmlns:iosColorPicker="clr-namespace:AdvancedColorPicker;assembly=DemoLights.iOS;targetPlatform=iOS"
xmlns:iosControls="clr-namespace:DemoLights.iOS;assembly=DemoLights.iOS;targetPlatform=iOS"
xmlns:androidLights="clr-namespace:DemoLights.Droid;assembly=DemoLights.Droid;targetPlatform=Android"
>
<Grid>
<local:GradientBackgroundView StartColor="Black" EndColor="#434343" />
<ListView x:Name="List" ItemsSource="{Binding Lights}" Style="{StaticResource listStyle}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="5,10,5,10" BackgroundColor="{Binding Color}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.6*" />
<ColumnDefinition Width="0.2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="15" />
</Grid.RowDefinitions>
<controls:CircleImage Style="{StaticResource lightsImageStyle}" IsEnabled="{Binding IsOn}" BorderColor="{Binding Color}" FillColor="{Binding Color}" Grid.Column="0" Grid.RowSpan="2">
<controls:CircleImage.GestureRecognizers>
<TapGestureRecognizer Tapped="LightTapped" />
</controls:CircleImage.GestureRecognizers>
</controls:CircleImage>
<Label Text="{Binding Name}" Grid.Column="1" VerticalOptions="End" Style="{StaticResource labelStyle}" />
<Label Text="{Binding State}" Grid.Column="1" Grid.Row="1" VerticalOptions="Start" Style="{StaticResource labelStyle}" />
<Switch x:Name="switch" IsToggled="{Binding IsOn}" Grid.Column="2" Grid.RowSpan="2" VerticalOptions="Center" />
<Slider Minimum="0" Maximum="255" Value="{Binding Brightness}" Grid.Row="2" Grid.ColumnSpan="3" Opacity="0">
<Slider.Triggers>
<DataTrigger TargetType="Slider" Binding="{Binding IsOn}" Value="true">
<DataTrigger.EnterActions>
<local:FadeTriggerAction StartsFrom="1" />
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<local:FadeTriggerAction StartsFrom="0" />
</DataTrigger.ExitActions>
</DataTrigger>
</Slider.Triggers>
</Slider>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<ContentView x:Name="ColorPicker" TranslationY="400" BackgroundColor="Black" VerticalOptions="End" HeightRequest="400">
<ContentView.Resources>
<ResourceDictionary>
<iosControls:UIColorConverter x:Key="colorConverterIOS" />
<androidLights:DroidColorConverter x:Key="colorConverterDroid" />
</ResourceDictionary>
</ContentView.Resources>
<StackLayout x:Name="ColorPickerRoot">
<Button Text="Dismiss" Clicked="DismissClicked" />
<iosColorPicker:ColorPickerView SelectedColor="{Binding Path=PickerSelectedColor, Mode=TwoWay,Converter={StaticResource colorConverterIOS},UpdateSourceEventName=ColorPicked}">
<x:Arguments>
<iosCoreGraphics:CGRect>
<x:Arguments>
<x:Double>0</x:Double>
<x:Double>0</x:Double>
<x:Double>300</x:Double>
<x:Double>300</x:Double>
</x:Arguments>
</iosCoreGraphics:CGRect>
</x:Arguments>
</iosColorPicker:ColorPickerView>
<androidLights:ColorPickerView SelectedColor="{Binding Path=PickerSelectedColor,
Mode=TwoWay,
Converter={StaticResource colorConverterDroid},
UpdateSourceEventName=ColorPicked}" />
</StackLayout>
</ContentView>
</Grid>
</ContentPage>