Skip to content

Commit 838b491

Browse files
committed
✨ rendering pages with corr. Attributes, styling
1 parent 0b13125 commit 838b491

14 files changed

+387
-19
lines changed

Biyori/Biyori.csproj

+23
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@
7171
<Compile Include="Components\LeftNavigation\LeftNavigationControl.xaml.cs">
7272
<DependentUpon>LeftNavigationControl.xaml</DependentUpon>
7373
</Compile>
74+
<Compile Include="Lib\Controls\CardControl.cs" />
7475
<Compile Include="Lib\WPF\MarginSetter.cs" />
7576
<Compile Include="Lib\WPF\Spacing.cs" />
77+
<Compile Include="Settings\Frames\SettingsPage-Accounts.xaml.cs">
78+
<DependentUpon>SettingsPage-Accounts.xaml</DependentUpon>
79+
</Compile>
80+
<Compile Include="Settings\Frames\SettingsPage-General.xaml.cs">
81+
<DependentUpon>SettingsPage-General.xaml</DependentUpon>
82+
</Compile>
7683
<Compile Include="Settings\SettingsWindow.xaml.cs">
7784
<DependentUpon>SettingsWindow.xaml</DependentUpon>
7885
</Compile>
@@ -84,6 +91,10 @@
8491
<SubType>Designer</SubType>
8592
<Generator>MSBuild:Compile</Generator>
8693
</Page>
94+
<Page Include="Lib\Controls\CardControl.style.xaml">
95+
<SubType>Designer</SubType>
96+
<Generator>MSBuild:Compile</Generator>
97+
</Page>
8798
<Page Include="Lib\Languages\en-us.lang.xaml">
8899
<SubType>Designer</SubType>
89100
<Generator>MSBuild:Compile</Generator>
@@ -96,6 +107,10 @@
96107
<SubType>Designer</SubType>
97108
<Generator>MSBuild:Compile</Generator>
98109
</Page>
110+
<Page Include="Lib\Styles\Buttons.styles.xaml">
111+
<SubType>Designer</SubType>
112+
<Generator>MSBuild:Compile</Generator>
113+
</Page>
99114
<Page Include="MainWindow.dictionary.xaml">
100115
<SubType>Designer</SubType>
101116
<Generator>MSBuild:Compile</Generator>
@@ -112,6 +127,14 @@
112127
<DependentUpon>MainWindow.xaml</DependentUpon>
113128
<SubType>Code</SubType>
114129
</Compile>
130+
<Page Include="Settings\Frames\SettingsPage-Accounts.xaml">
131+
<SubType>Designer</SubType>
132+
<Generator>MSBuild:Compile</Generator>
133+
</Page>
134+
<Page Include="Settings\Frames\SettingsPage-General.xaml">
135+
<SubType>Designer</SubType>
136+
<Generator>MSBuild:Compile</Generator>
137+
</Page>
115138
<Page Include="Settings\SettingsWindow.dictionary.xaml">
116139
<SubType>Designer</SubType>
117140
<Generator>MSBuild:Compile</Generator>

Biyori/Lib/Controls/CardControl.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows.Controls;
7+
8+
namespace Biyori.Lib.Controls
9+
{
10+
public class CardControl : ContentControl
11+
{
12+
static CardControl()
13+
{
14+
DefaultStyleKeyProperty.OverrideMetadata(typeof(CardControl),
15+
new System.Windows.FrameworkPropertyMetadata(typeof(CardControl)));
16+
}
17+
18+
}
19+
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:local="clr-namespace:Biyori.Lib.Controls">
4+
5+
<Style TargetType="{x:Type local:CardControl}">
6+
<Setter Property="Template">
7+
<Setter.Value>
8+
<ControlTemplate TargetType="{x:Type local:CardControl}">
9+
<Grid ClipToBounds="False">
10+
<Border Padding="{TemplateBinding Padding}">
11+
<Border.Style>
12+
13+
<Style TargetType="Border">
14+
<Setter Property="Padding" Value="10"/>
15+
<Setter Property="Background" Value="#ffffff" />
16+
<Setter Property="CornerRadius" Value="6"/>
17+
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
18+
<Setter Property="SnapsToDevicePixels" Value="True"/>
19+
<Setter Property="Effect">
20+
<Setter.Value>
21+
<DropShadowEffect BlurRadius="2" Opacity=".675" Direction="90" Color="#000000" ShadowDepth="0" RenderOptions.EdgeMode="Aliased" RenderOptions.BitmapScalingMode="NearestNeighbor" />
22+
</Setter.Value>
23+
</Setter>
24+
</Style>
25+
</Border.Style>
26+
<Grid>
27+
<ContentControl Content="{TemplateBinding Content}"></ContentControl>
28+
</Grid>
29+
</Border>
30+
</Grid>
31+
</ControlTemplate>
32+
</Setter.Value>
33+
</Setter>
34+
</Style>
35+
</ResourceDictionary>

Biyori/Lib/Styles/App.styles.xaml

+4
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
<Setter Property="FontStyle" Value="Italic" />
77
<Setter Property="FontSize" Value="12" />
88
</Style>
9+
<ResourceDictionary.MergedDictionaries>
10+
<ResourceDictionary Source="pack://application:,,,/Lib/Styles/Buttons.styles.xaml" />
11+
<ResourceDictionary Source="pack://application:,,,/Lib/Controls/CardControl.style.xaml" />
12+
</ResourceDictionary.MergedDictionaries>
913
</ResourceDictionary>

Biyori/Lib/Styles/Buttons.styles.xaml

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:local="clr-namespace:Biyori.Lib.Styles">
4+
5+
<Style x:Key="NavButtons" TargetType="Button">
6+
<Setter Property="OverridesDefaultStyle" Value="True"/>
7+
<Setter Property="Margin" Value="0" />
8+
<Setter Property="Padding" Value="8, 6" />
9+
<!--<Setter Property="FocusVisualStyle" Value="{StaticResource MyFocusVisual}" />-->
10+
<Setter Property="Background" Value="#fafafa"/>
11+
<Setter Property="Template">
12+
<Setter.Value>
13+
<ControlTemplate TargetType="Button">
14+
<ControlTemplate.Resources>
15+
16+
17+
<Storyboard x:Key="GlowOn">
18+
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
19+
Storyboard.TargetName="border"
20+
Storyboard.TargetProperty="(Effect).Opacity">
21+
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value=".8"/>
22+
</DoubleAnimationUsingKeyFrames>
23+
</Storyboard>
24+
<Storyboard x:Key="GlowOff">
25+
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
26+
Storyboard.TargetName="border"
27+
Storyboard.TargetProperty="(Effect).Opacity">
28+
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value=".4"/>
29+
</DoubleAnimationUsingKeyFrames>
30+
</Storyboard>
31+
<Storyboard x:Key="JellyClick">
32+
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
33+
Storyboard.TargetName="border"
34+
Storyboard.TargetProperty="(RenderTransform).ScaleX">
35+
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value=".925"/>
36+
</DoubleAnimationUsingKeyFrames>
37+
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
38+
Storyboard.TargetName="border"
39+
Storyboard.TargetProperty="(RenderTransform).ScaleY">
40+
<SplineDoubleKeyFrame KeyTime="0:0:0.3" Value=".925"/>
41+
</DoubleAnimationUsingKeyFrames>
42+
</Storyboard>
43+
<Storyboard x:Key="JellyClickOff">
44+
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
45+
Storyboard.TargetName="border"
46+
Storyboard.TargetProperty="(RenderTransform).ScaleX">
47+
<SplineDoubleKeyFrame KeyTime="0:0:0.15" Value="1"/>
48+
</DoubleAnimationUsingKeyFrames>
49+
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
50+
Storyboard.TargetName="border"
51+
Storyboard.TargetProperty="(RenderTransform).ScaleY">
52+
<SplineDoubleKeyFrame KeyTime="0:0:0.15" Value="1"/>
53+
</DoubleAnimationUsingKeyFrames>
54+
</Storyboard>
55+
</ControlTemplate.Resources>
56+
<Grid Margin="{TemplateBinding Margin}">
57+
<Border Name="border"
58+
BorderThickness="0"
59+
Margin="{TemplateBinding Margin}"
60+
Padding="{TemplateBinding Padding}"
61+
BorderBrush="DarkGray"
62+
CornerRadius="2"
63+
Background="{TemplateBinding Background}">
64+
<Border.Effect>
65+
<DropShadowEffect x:Name="shadow" RenderingBias="Quality" Direction="90" BlurRadius="4" ShadowDepth="0" Color="#000" Opacity=".4" />
66+
</Border.Effect>
67+
<Border.Resources>
68+
</Border.Resources>
69+
<Border.RenderTransformOrigin>
70+
<Point X=".5" Y=".5" />
71+
</Border.RenderTransformOrigin>
72+
<Border.RenderTransform>
73+
<ScaleTransform ScaleX="1" ScaleY="1" RenderOptions.BitmapScalingMode="NearestNeighbor" />
74+
</Border.RenderTransform>
75+
<Grid>
76+
<ContentPresenter HorizontalAlignment="Center"
77+
VerticalAlignment="Center" Name="content"/>
78+
</Grid>
79+
</Border>
80+
</Grid>
81+
<ControlTemplate.Triggers>
82+
<Trigger Property="IsMouseOver" Value="True">
83+
<Setter Property="Background" Value="#fff" />
84+
<Trigger.EnterActions>
85+
<BeginStoryboard Storyboard="{StaticResource GlowOn}" />
86+
</Trigger.EnterActions>
87+
<Trigger.ExitActions>
88+
<BeginStoryboard Storyboard="{StaticResource GlowOff}" />
89+
</Trigger.ExitActions>
90+
</Trigger>
91+
<Trigger Property="IsPressed" Value="True">
92+
<Trigger.EnterActions>
93+
<BeginStoryboard Storyboard="{StaticResource GlowOn}" />
94+
<BeginStoryboard Storyboard="{StaticResource JellyClick}" />
95+
</Trigger.EnterActions>
96+
<Trigger.ExitActions>
97+
<BeginStoryboard Storyboard="{StaticResource GlowOff}" />
98+
<BeginStoryboard Storyboard="{StaticResource JellyClickOff}" />
99+
</Trigger.ExitActions>
100+
</Trigger>
101+
<Trigger Property="IsDefaulted" Value="True">
102+
</Trigger>
103+
<Trigger Property="IsFocused" Value="True">
104+
</Trigger>
105+
<Trigger Property="IsEnabled" Value="False">
106+
<Setter Property="Background" Value="#ddd" />
107+
</Trigger>
108+
109+
</ControlTemplate.Triggers>
110+
</ControlTemplate>
111+
</Setter.Value>
112+
</Setter>
113+
</Style>
114+
</ResourceDictionary>

Biyori/MainWindow.dictionary.xaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:local="clr-namespace:Biyori">
44
<SolidColorBrush Color="#cccccc" x:Key="NavBorderColor" />
55
<Style x:Key="leftNav" TargetType="Border">
6-
<Setter Property="BorderThickness" Value="0, 1, 1, 0" />
6+
<Setter Property="BorderThickness" Value="0" />
77
<Setter Property="BorderBrush" Value="{StaticResource NavBorderColor}" />
88
<Setter Property="Background" Value="#efefef" />
99
</Style>
@@ -12,4 +12,6 @@
1212
<Setter Property="BorderBrush" Value="{StaticResource NavBorderColor}" />
1313
<Setter Property="Background" Value="#efefef" />
1414
</Style>
15+
<DropShadowEffect x:Key="ShadowStyle" BlurRadius="8" ShadowDepth="-4" Color="#444444"></DropShadowEffect>
16+
1517
</ResourceDictionary>

Biyori/MainWindow.xaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ColumnDefinition Width="200px" />
2121
</Grid.ColumnDefinitions>
2222
<Grid.RowDefinitions>
23-
<RowDefinition Height="36px" />
23+
<RowDefinition Height="46px" />
2424
<RowDefinition Height="*" />
2525
<RowDefinition Height="28px" />
2626
</Grid.RowDefinitions>
@@ -30,17 +30,17 @@
3030
</Grid>
3131
</Border>
3232
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
33-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" wpf:MarginSetter.Margin="4, 0" wpf:MarginSetter.LastItemMargin="4, 0, 0, 0">
34-
<Button HorizontalAlignment="Left" VerticalAlignment="Center" Padding="6">Sync</Button>
33+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" wpf:MarginSetter.Margin="2, 0" wpf:MarginSetter.LastItemMargin="2, 0, 0, 0">
34+
<Button Style="{StaticResource NavButtons}" HorizontalAlignment="Left" VerticalAlignment="Center">Sync</Button>
3535
<Grid>
3636
<Separator Background="LightGray" Margin="0, 14" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" VerticalAlignment="Stretch"></Separator>
3737
</Grid>
38-
<Button HorizontalAlignment="Left" VerticalAlignment="Center" Padding="6">Folders</Button>
39-
<Button HorizontalAlignment="Left" VerticalAlignment="Center" Padding="6">Sources</Button>
38+
<Button Style="{StaticResource NavButtons}" HorizontalAlignment="Left" VerticalAlignment="Center">Folders</Button>
39+
<Button Style="{StaticResource NavButtons}" HorizontalAlignment="Left" VerticalAlignment="Center">Sources</Button>
4040
<Grid>
4141
<Separator Background="LightGray" Margin="0, 14" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" VerticalAlignment="Stretch"></Separator>
4242
</Grid>
43-
<Button Click="onSettingsClick" HorizontalAlignment="Left" VerticalAlignment="Center" Padding="6">Settings</Button>
43+
<Button Style="{StaticResource NavButtons}" Click="onSettingsClick" HorizontalAlignment="Left" VerticalAlignment="Center">Settings</Button>
4444
</StackPanel>
4545
</Grid>
4646
<Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2">

Biyori/MainWindow.xaml.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public MainWindow()
2929

3030
private void onSettingsClick(object sender, RoutedEventArgs e)
3131
{
32-
new Settings.SettingsWindow().ShowDialog();
32+
var settingsWindow = new Settings.SettingsWindow();
33+
settingsWindow.Owner = this;
34+
settingsWindow.ShowDialog();
3335
}
3436
}
3537
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Page x:Class="Biyori.Settings.Frames.SettingsPage_Accounts"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Biyori.Settings.Frames"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800"
9+
Title="SettingsPage_Accounts">
10+
11+
<Grid>
12+
<TextBlock>Accounts Page Works!</TextBlock>
13+
</Grid>
14+
</Page>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Biyori.Settings.Frames
17+
{
18+
[SettingsRoute("accounts", "Accounts", true)]
19+
/// <summary>
20+
/// Interaction logic for SettingsPage_Accounts.xaml
21+
/// </summary>
22+
public partial class SettingsPage_Accounts : Page
23+
{
24+
public SettingsPage_Accounts()
25+
{
26+
InitializeComponent();
27+
}
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Page x:Class="Biyori.Settings.Frames.SettingsPage_General"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Biyori.Settings.Frames"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800"
9+
Title="SettingsPage_General">
10+
11+
<Grid>
12+
<TextBlock>General Page Works!</TextBlock>
13+
</Grid>
14+
</Page>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace Biyori.Settings.Frames
17+
{
18+
[SettingsRoute("services", "Services", true)]
19+
/// <summary>
20+
/// Interaction logic for SettingsPage_General.xaml
21+
/// </summary>
22+
public partial class SettingsPage_General : Page
23+
{
24+
public SettingsPage_General()
25+
{
26+
InitializeComponent();
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)