This commit is contained in:
Holger Börchers 2020-04-20 22:11:36 +02:00
parent c507cb5b4d
commit 441d1d2010
4 changed files with 105 additions and 90 deletions

View File

@ -3,13 +3,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dryIoc="http://prismlibrary.com/" xmlns:dryIoc="http://prismlibrary.com/"
xmlns:local="clr-namespace:ModernWpfPlayground"
xmlns:ui="http://schemas.modernwpf.com/2019"> xmlns:ui="http://schemas.modernwpf.com/2019">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<local:IntellisenseResourceDictionary Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
<ui:ThemeResources /> <ui:ThemeResources />
<ui:IntellisenseResources Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
<ui:XamlControlsResources /> <ui:XamlControlsResources />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>

View File

@ -6,8 +6,8 @@
xmlns:local="clr-namespace:ModernWpfPlayground" xmlns:local="clr-namespace:ModernWpfPlayground"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:propertyPresenter="clr-namespace:ModernWpfPlayground.PropertyPresenter" xmlns:propertyPresenter="clr-namespace:ModernWpfPlayground.PropertyPresenter"
xmlns:ui="http://schemas.modernwpf.com/2019"
x:Name="Window" x:Name="Window"
Title="{Binding Title}" Title="{Binding Title}"
Width="{Binding WindowWidth, Mode=TwoWay}" Width="{Binding WindowWidth, Mode=TwoWay}"
@ -155,109 +155,118 @@
<Grid Row="1"> <Grid Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="40" /> <ColumnDefinition Width="40" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border <Border
Grid.Column="0" Grid.Column="0"
Background="#2C2C2C" Background="#2C2C2C"
BorderThickness="0"> BorderThickness="0">
<StackPanel HorizontalAlignment="Center"> <ui:SimpleStackPanel HorizontalAlignment="Center" Spacing="10">
<ui:SimpleStackPanel.Resources>
<Style TargetType="TextBlock">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90" />
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ui:ToggleSwitch">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90" />
</Setter.Value>
</Setter>
</Style>
</ui:SimpleStackPanel.Resources>
<ui:ToggleSwitch Margin="0,5,0,0" IsOn="{Binding IsPaneOpen}" />
<TextBlock <TextBlock
Margin="0,10"
Cursor="Hand" Cursor="Hand"
FontSize="20" FontSize="20"
Foreground="#F4F4F4" Foreground="#F4F4F4"
Text="Dummy active"> Text="Dummy active" />
<TextBlock.LayoutTransform>
<RotateTransform Angle="270" />
</TextBlock.LayoutTransform>
</TextBlock>
<TextBlock <TextBlock
Margin="0,10"
Cursor="Hand" Cursor="Hand"
FontSize="20" FontSize="20"
Foreground="#808080" Foreground="#808080"
Text="Dummy inactive"> Text="Dummy inactive" />
<TextBlock.LayoutTransform> </ui:SimpleStackPanel>
<RotateTransform Angle="270" />
</TextBlock.LayoutTransform>
</TextBlock>
</StackPanel>
</Border> </Border>
<TreeView <ui:SplitView
Grid.Column="1" Grid.Column="1"
MinWidth="180" BorderThickness="0"
BorderThickness="0"> DisplayMode="Inline"
<TreeViewItem Header="Root" IsExpanded="True"> IsPaneOpen="{Binding IsPaneOpen}"
<TreeViewItem Header="Child1" /> PanePlacement="Left">
<TreeViewItem Header="Child2" /> <ui:SplitView.Pane>
<TreeViewItem Header="Child3" /> <TreeViewItem Header="Root" IsExpanded="True">
</TreeViewItem> <TreeViewItem Header="Child1" />
</TreeView> <TreeViewItem Header="Child2" />
<TabControl Grid.Column="2"> <TreeViewItem Header="Child3" />
<TabItem Header="Bolt"> </TreeViewItem>
<Grid> </ui:SplitView.Pane>
<Grid.ColumnDefinitions> <TabControl>
<ColumnDefinition /> <TabItem Header="Bolt">
<ColumnDefinition /> <Grid>
<ColumnDefinition /> <Grid.ColumnDefinitions>
</Grid.ColumnDefinitions> <ColumnDefinition />
<ui:SimpleStackPanel <ColumnDefinition />
Grid.Column="0" <ColumnDefinition />
Margin="5" </Grid.ColumnDefinitions>
Orientation="Vertical" <ui:SimpleStackPanel
Spacing="5"> Grid.Column="0"
<Button Margin="5"
HorizontalAlignment="Stretch" Orientation="Vertical"
Command="{Binding OpenViewModelCommand}" Spacing="5">
Content="Open" /> <Button
<Button HorizontalAlignment="Stretch"
HorizontalAlignment="Stretch" Command="{Binding OpenViewModelCommand}"
Command="{Binding SaveViewModelCommand}" Content="Open" />
Content="Save" /> <Button
HorizontalAlignment="Stretch"
Command="{Binding SaveViewModelCommand}"
Content="Save" />
</ui:SimpleStackPanel>
</Grid>
</TabItem>
<TabItem Header="General" IsSelected="True">
<ui:SimpleStackPanel Margin="5" Spacing="10">
<propertyPresenter:PropertyPresenter Label="Theme Mode" Value="{Binding ThemeMode}" />
<propertyPresenter:PropertyPresenter
Command="{Binding ShowDialogCommand}"
Label="Hello"
Symbol="x³"
Value="{Binding WelcomeMessage}" />
<propertyPresenter:PropertyPresenter
IsReadOnly="True"
Label="Hallo"
Symbol="x²"
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
<propertyPresenter:PropertyPresenter
Label="Good bye"
Symbol="x²"
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
<propertyPresenter:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
<propertyPresenter:PropertyPresenter Label="Hello">
<Slider
AutoToolTipPlacement="TopLeft"
Interval="1"
IsSnapToTickEnabled="True"
Maximum="150"
Minimum="50"
TickFrequency="10"
TickPlacement="BottomRight"
Value="{Binding SliderTest}" />
</propertyPresenter:PropertyPresenter>
<ui:ProgressRing
Width="{Binding SliderTest}"
Height="{Binding SliderTest}"
IsActive="{Binding BooleanValue}"
Visibility="{Binding VisibilityEnumTest}" />
<propertyPresenter:PropertyPresenter Label="Visi" Value="{Binding VisibilityEnumTest}" />
</ui:SimpleStackPanel> </ui:SimpleStackPanel>
</Grid> </TabItem>
</TabItem> </TabControl>
<TabItem Header="General" IsSelected="True"> </ui:SplitView>
<ui:SimpleStackPanel Margin="5" Spacing="10">
<propertyPresenter:PropertyPresenter Label="Theme Mode" Value="{Binding ThemeMode}" />
<propertyPresenter:PropertyPresenter
Command="{Binding ShowDialogCommand}"
Label="Hello"
Symbol="x³"
Value="{Binding WelcomeMessage}" />
<propertyPresenter:PropertyPresenter
IsReadOnly="True"
Label="Hallo"
Symbol="x²"
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
<propertyPresenter:PropertyPresenter
Label="Good bye"
Symbol="x²"
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
<propertyPresenter:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
<propertyPresenter:PropertyPresenter Label="Hello">
<Slider
AutoToolTipPlacement="TopLeft"
Interval="1"
IsSnapToTickEnabled="True"
Maximum="150"
Minimum="50"
TickFrequency="10"
TickPlacement="BottomRight"
Value="{Binding SliderTest}" />
</propertyPresenter:PropertyPresenter>
<ui:ProgressRing
Width="{Binding SliderTest}"
Height="{Binding SliderTest}"
IsActive="{Binding BooleanValue}"
Visibility="{Binding VisibilityEnumTest}" />
<propertyPresenter:PropertyPresenter Label="Visi" Value="{Binding VisibilityEnumTest}" />
<TextBox Text="Dummy" />
</ui:SimpleStackPanel>
</TabItem>
</TabControl>
</Grid> </Grid>
</DockPanel> </DockPanel>
</Window> </Window>

View File

@ -18,6 +18,7 @@ namespace ModernWpfPlayground
private string _title = AppName; private string _title = AppName;
private readonly ISerializer _serializer; private readonly ISerializer _serializer;
private readonly IDeserializer _deserializer; private readonly IDeserializer _deserializer;
private bool _isPaneOpen = true;
public MainWindowViewModel() public MainWindowViewModel()
{ {
@ -105,6 +106,12 @@ namespace ModernWpfPlayground
set => SetProperty(value); set => SetProperty(value);
} }
public bool IsPaneOpen
{
get => _isPaneOpen;
set => SetProperty(ref _isPaneOpen, value);
}
private static void SetTheme(ThemeMode themeMode) private static void SetTheme(ThemeMode themeMode)
{ {
ThemeManager.Current.ApplicationTheme = themeMode switch ThemeManager.Current.ApplicationTheme = themeMode switch

View File

@ -9,7 +9,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FastMember" Version="1.5.0" /> <PackageReference Include="FastMember" Version="1.5.0" />
<PackageReference Include="ModernWpfUI" Version="0.8.2" /> <PackageReference Include="ModernWpfUI" Version="0.8.3" />
<PackageReference Include="Prism.DryIoc" Version="7.2.0.1422" /> <PackageReference Include="Prism.DryIoc" Version="7.2.0.1422" />
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" /> <PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
<PackageReference Include="YamlDotNet" Version="8.1.0" /> <PackageReference Include="YamlDotNet" Version="8.1.0" />