Skip to content

Commit

Permalink
feat: make UrsaView base.
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitism committed Aug 13, 2024
1 parent 7479cff commit 2789f88
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 3 additions & 1 deletion demo/Ursa.Demo/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Ursa.Demo.ViewModels;
Expand All @@ -17,8 +18,9 @@ public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow()
desktop.MainWindow = new Window()
{
Content = new SingleView(),
DataContext = new MainViewViewModel(),
};
}
Expand Down
11 changes: 6 additions & 5 deletions src/Ursa.Themes.Semi/Controls/UrsaView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
<u:TitleBar
<Grid ColumnDefinitions="Auto, *, Auto"
VerticalAlignment="Top"
Content="{Binding $parent[u:UrsaWindow].TitleBarContent}"
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}"
LeftContent="{Binding $parent[u:UrsaWindow].LeftContent}"
RightContent="{Binding $parent[u:UrsaWindow].RightContent}" />
Margin="{Binding $parent[u:UrsaWindow].TitleBarMargin}">
<ContentPresenter Grid.Column="0" Content="{TemplateBinding LeftContent}" VerticalAlignment="Center"/>
<ContentPresenter Grid.Column="1" Content="{TemplateBinding TitleBarContent}" VerticalAlignment="Center"/>
<ContentPresenter Grid.Column="2" Content="{TemplateBinding RightContent}" VerticalAlignment="Center"/>
</Grid>
<u:OverlayDialogHost IsModalStatusReporter="True" />
</Panel>
</Panel>
Expand Down
14 changes: 14 additions & 0 deletions src/Ursa.Themes.Semi/Styles/UrsaView.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:u="https://irihi.tech/ursa">
<Design.PreviewWith>
<Border Padding="20">
<!-- Add Controls for Previewer Here -->
</Border>
</Design.PreviewWith>

<!-- Add Styles Here -->
<Style Selector=":is(u|UrsaView)">
<Setter Property="Theme" Value="{DynamicResource {x:Type u:UrsaView}}"/>
</Style>
</Styles>
1 change: 1 addition & 0 deletions src/Ursa.Themes.Semi/Styles/_index.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<StyleInclude Source="Skeleton.axaml" />
<StyleInclude Source="ToolBar.axaml"/>
<StyleInclude Source="TimeBox.axaml"/>
<StyleInclude Source="UrsaView.axaml" />
<!-- Add Styles Here -->
</Styles>

0 comments on commit 2789f88

Please sign in to comment.