color-picker/MainWindow.xaml
2023-03-08 14:13:08 +01:00

40 lines
1.8 KiB
XML

<Window x:Class="ColorPicker.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:ColorPicker.ViewModels"
mc:Ignorable="d"
Title="MainWindow" Height="600" Width="400">
<Window.Resources>
<vm:ColorPickerViewModel x:Key="viewModel"/>
</Window.Resources>
<Grid DataContext="{StaticResource viewModel}">
<Grid.RowDefinitions>
<RowDefinition Height="4*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8*" />
</Grid.ColumnDefinitions>
<Rectangle Fill="{Binding Color}" Margin="10" Name="RGBColor" Grid.Row="0" Grid.ColumnSpan="2"/>
<Label Content="Red" Grid.Row="1"/>
<Label Content="Green" Grid.Row="2"/>
<Label Content="Blue" Grid.Row="3"/>
<Slider Name="RedSlider" Maximum="255" Grid.Row="1" Grid.Column="1" Value="{Binding Red}" />
<Slider Name="GreenSlider" Maximum="255" Grid.Row="2" Grid.Column="1" Value="{Binding Green}"/>
<Slider Name="BlueSlider" Maximum="255" Grid.Row="3" Grid.Column="1" Value="{Binding Blue}"/>
<TextBox
Name="RGBInHex"
Grid.Row="4"
Grid.ColumnSpan="2"
Margin="10"
Text="{Binding Path=HexInput, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</Window>