Skip to content

Commit

Permalink
Updated Avalonia to 0.10.0-preview1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jp2masa committed Jul 16, 2020
1 parent a3a8920 commit bf9bbb0
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 141 deletions.
4 changes: 1 addition & 3 deletions CSharpMath.Avalonia.Example/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

<Application.Styles>

<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml"/>

<StyleInclude Source="/SideBar.xaml"/>
<StyleInclude Source="/Styles.xaml"/>

</Application.Styles>
Expand Down
15 changes: 2 additions & 13 deletions CSharpMath.Avalonia.Example/CSharpMath.Avalonia.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,9 @@
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<AvaloniaResource Include="**\*.xaml" />
<EmbeddedResource Include="..\Icon.png" Link="Icon.png" />
<PackageReference Include="Avalonia.Desktop" Version="0.9.6" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
<ProjectReference Include="..\CSharpMath.Avalonia\CSharpMath.Avalonia.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Pages\MathButtonPage.xaml.cs">
<DependentUpon>MathButtonPage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\MathViewPage.xaml.cs">
<DependentUpon>MathViewPage.xaml</DependentUpon>
</Compile>
<Compile Update="Pages\TextViewPage.xaml.cs">
<DependentUpon>TextViewPage.xaml</DependentUpon>
</Compile>
</ItemGroup>

</Project>
57 changes: 27 additions & 30 deletions CSharpMath.Avalonia.Example/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,32 @@
Foreground="{DynamicResource ThemeForegroundBrush}"
FontSize="{DynamicResource FontSizeNormal}">

<TabControl x:Name="Sidebar"
Classes="sidebar">

<TabControl.Tag>

<ComboBox x:Name="Themes"
DockPanel.Dock="Bottom"
SelectedIndex="0"
Width="100"
Margin="8">

<ComboBoxItem>Light</ComboBoxItem>
<ComboBoxItem>Dark</ComboBoxItem>

</ComboBox>

</TabControl.Tag>

<TabItem Header="MathView">
<pages:MathViewPage/>
</TabItem>

<TabItem Header="TextView">
<pages:TextViewPage/>
</TabItem>
<TabItem Header="MathButton">
<pages:MathButtonPage/>
</TabItem>

</TabControl>
<DockPanel>


<ComboBox x:Name="Themes"
DockPanel.Dock="Bottom"
HorizontalAlignment="Right"
SelectedIndex="0"
Width="100"
Margin="8">
<ComboBoxItem>Light</ComboBoxItem>
<ComboBoxItem>Dark</ComboBoxItem>
</ComboBox>

<TabControl x:Name="Sidebar"
Padding="16">
<TabItem Header="MathView">
<pages:MathViewPage/>
</TabItem>
<TabItem Header="TextView">
<pages:TextViewPage/>
</TabItem>
<TabItem Header="MathButton">
<pages:MathButtonPage/>
</TabItem>
</TabControl>

</DockPanel>

</UserControl>
11 changes: 5 additions & 6 deletions CSharpMath.Avalonia.Example/MainView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.Styling;
Expand All @@ -7,21 +8,19 @@ public class MainView : UserControl {
public MainView() {
InitializeComponent();

var light = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Default/Accents/BaseLight.xaml'/>");
var dark = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Default/Accents/BaseDark.xaml'/>");
var light = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml'/>");
var dark = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml'/>");
var themes = this.Find<ComboBox>("Themes");
themes.SelectionChanged += (sender, e) => {
switch (themes.SelectedIndex) {
case 0:
Styles[0] = light;
Application.Current.Styles[0] = light;
break;
case 1:
Styles[0] = dark;
Application.Current.Styles[0] = dark;
break;
}
};

Styles.Add(light);
}

private void InitializeComponent() {
Expand Down
84 changes: 0 additions & 84 deletions CSharpMath.Avalonia.Example/SideBar.xaml

This file was deleted.

2 changes: 1 addition & 1 deletion CSharpMath.Avalonia/CSharpMath.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<AvaloniaResource Include="**\*.xaml" />
<PackageReference Include="Avalonia" Version="0.9.6" />
<PackageReference Include="Avalonia" Version="0.10.0-preview1" />
<ProjectReference Include="..\CSharpMath.Rendering\CSharpMath.Rendering.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Compile Include="..\CSharpMath.CoreTests\_Helpers\ApproximateAssertions.cs" Link="ApproximateAssertions.cs" />
<ProjectReference Include="..\CSharpMath.Avalonia\CSharpMath.Avalonia.csproj" />
<ProjectReference Include="..\CSharpMath.SkiaSharp\CSharpMath.SkiaSharp.csproj" />
<PackageReference Include="Avalonia.Skia" Version="0.9.4" />
<PackageReference Include="Avalonia.Skia" Version="0.10.0-preview1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.8" />
Expand Down
6 changes: 3 additions & 3 deletions CSharpMath.Xaml/Views.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ void PropertyChanged(TThis @this, object newValue) {
public BaseView() {
// Respect built-in styles
Styles.Add(new global::Avalonia.Styling.Style(global::Avalonia.Styling.Selectors.Is<BaseView<TPainter, TContent>>) {
Setters = new[]
Setters =
{
new global::Avalonia.Styling.Setter(TextColorProperty, new global::Avalonia.Markup.Xaml.MarkupExtensions.DynamicResourceExtension("ThemeForegroundColor")),
new global::Avalonia.Styling.Setter(FontSizeProperty, new global::Avalonia.Markup.Xaml.MarkupExtensions.DynamicResourceExtension("FontSizeNormal"))
new global::Avalonia.Styling.Setter(TextColorProperty, new global::Avalonia.Markup.Xaml.MarkupExtensions.DynamicResourceExtension("SystemBaseHighColor")),
new global::Avalonia.Styling.Setter(FontSizeProperty, 14.0f)
}
});
}
Expand Down

0 comments on commit bf9bbb0

Please sign in to comment.