StyletWpfExamples/StyletBasicNavigation/Views/ShellView.xaml

50 lines
3.1 KiB
XML

<Window x:Class="StyletBasicNavigation.Views.ShellView"
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:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:StyletBasicNavigation.ViewModels"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ShellViewModel}"
xmlns:converters="clr-namespace:StyletBasicNavigation.Converters"
Title="Stylet Basic Navigation" Height="450" Width="800">
<Window.Resources>
<converters:StringToBrushConverter x:Key="StringToBrushConverter" />
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border BorderThickness="2" BorderBrush="Black">
<WrapPanel Orientation="Horizontal">
<WrapPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="10,5,0,5"/>
</Style>
</WrapPanel.Resources>
<Button IsEnabled="{Binding Path=IsRed, Converter={StaticResource InverseBooleanConverter}}" Content="Red View" FontSize="20" Foreground="White" Background="Red" Padding="5" Command="{s:Action UpdateViewProperty}" CommandParameter="red"/>
<Button IsEnabled="{Binding Path=IsBlue, Converter={StaticResource InverseBooleanConverter}}" Content="Blue View" FontSize="20" Foreground="White" Background="Blue" Padding="5" Command="{s:Action UpdateViewProperty}" CommandParameter="blue"/>
<Button IsEnabled="{Binding Path=IsGreen, Converter={StaticResource InverseBooleanConverter}}" Content="Green View" FontSize="20" Foreground="White" Background="Green" Padding="5" Command="{s:Action UpdateViewProperty}" CommandParameter="green"/>
<Button IsEnabled="{Binding Path=IsPurple, Converter={StaticResource InverseBooleanConverter}}" Content="Purple View" FontSize="20" Foreground="White" Background="Purple" Padding="5" Command="{s:Action UpdateViewProperty}" CommandParameter="purple"/>
</WrapPanel>
</Border>
<DockPanel Grid.Row="1">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ListBox ItemsSource="{Binding ViewsCollection}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=.}" Background="{Binding Converter={StaticResource StringToBrushConverter}}" Foreground="White" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
<ContentControl s:View.Model="{Binding ActiveItem}" Grid.Row="1"/>
</DockPanel>
</Grid>
</Window>