<Page
    x:Class="KoloryUA.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:KoloryUA"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="using:KoloryUA.ModelWidoku"
    xmlns:i="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
    mc:Ignorable="d" DataContext="{StaticResource modelWidoku}">
    <!--
    <Page.DataContext>
        <vm:EdycjaKoloru />
    </Page.DataContext>
    -->
    <Page.Resources>
        <local:ByteToDoubleConverter x:Key="byteToDouble" />
        <local:ColorToSolidColorBrushConverter x:Key="colorToBrush" />
    </Page.Resources>
    <i:Interaction.Behaviors>
        <local:ZamknięcieAplikacjiPoNaciśnieciuKlawisza Klawisz="Escape" />
    </i:Interaction.Behaviors>
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Rectangle x:Name="rectangle"
                   Margin="10,10,10,170" 
                   Stroke="Black"
                   Fill="{Binding Color, Mode=OneWay, Converter={StaticResource colorToBrush}}" />
        <Slider x:Name="sliderR" Maximum="255"
                Margin="10,0,49,130" Height="36" VerticalAlignment="Bottom" 
                Value="{Binding Path=R, Mode=TwoWay, Converter={StaticResource byteToDouble}}" />
        <Slider x:Name="sliderG" Maximum="255" 
                Margin="10,0,49,100" Height="36" VerticalAlignment="Bottom" 
                Value="{Binding Path=G, Mode=TwoWay, Converter={StaticResource byteToDouble}}" />
        <Slider x:Name="sliderB" Maximum="255"
                Margin="10,0,49,70" Height="36" VerticalAlignment="Bottom" 
                Value="{Binding Path=B, Mode=TwoWay, Converter={StaticResource byteToDouble}}" />
        <!--
        <Label x:Name="labelR" Content="{Binding ElementName=sliderR, Path=Value}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,10,55"/>
        <Label x:Name="labelG" Content="{Binding ElementName=sliderG, Path=Value}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,10,30" />
        <Label x:Name="labelB" Content="{Binding ElementName=sliderB, Path=Value}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,10,7" />
        -->
        <TextBlock x:Name="labelR" FontSize="20" Text="{Binding ElementName=sliderR, Path=Value}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,10,130"/>
        <TextBlock x:Name="labelG" FontSize="20" Text="{Binding ElementName=sliderG, Path=Value}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,10,100" />
        <TextBlock x:Name="labelB" FontSize="20" Text="{Binding ElementName=sliderB, Path=Value}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="0,0,10,70" />
        <Button Content="Resetuj"
                Height="50" Width="100" 
                VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="10,0,0,7"
                Command="{Binding Resetuj}" />
    </Grid>
</Page>

