新增骨架屏控件
This commit is contained in:
@@ -13,6 +13,7 @@ public static class MenuKeys
|
||||
public const string MenuKeyNavigation = "Navigation";
|
||||
public const string MenuKeyPagination = "Pagination";
|
||||
public const string MenuKeyTagInput = "TagInput";
|
||||
public const string MenuKeyTimeline = "Timeline";
|
||||
public const string MenuKeyTimeline = "Timeline";
|
||||
public const string MenuKeySkeleton = "Skeleton";
|
||||
|
||||
}
|
||||
58
demo/Ursa.Demo/Pages/SkeletonDemo.axaml
Normal file
58
demo/Ursa.Demo/Pages/SkeletonDemo.axaml
Normal file
@@ -0,0 +1,58 @@
|
||||
<UserControl
|
||||
x:Class="Ursa.Demo.Pages.SkeletonDemo"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
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:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="clr-namespace:Ursa.Demo.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Design.DataContext>
|
||||
<vm:SkeletonDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel>
|
||||
<ToggleSwitch Name="s" />
|
||||
<Grid MinWidth="400" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<u:Skeleton
|
||||
Width="100"
|
||||
Height="100"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #s.IsChecked}">
|
||||
<Image RenderOptions.BitmapInterpolationMode="HighQuality" Source="../Assets/Ursa.ico" />
|
||||
</u:Skeleton>
|
||||
<UniformGrid
|
||||
Grid.Column="1"
|
||||
Margin="5,0"
|
||||
Columns="1"
|
||||
Rows="3">
|
||||
<u:Skeleton
|
||||
Margin="0,0,200,0"
|
||||
VerticalAlignment="Top"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #s.IsChecked}">
|
||||
<TextBlock Margin="0,2" Text="是先有鸡还是先有蛋" />
|
||||
</u:Skeleton>
|
||||
<u:Skeleton
|
||||
Margin="0,0,100,0"
|
||||
VerticalAlignment="Center"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #s.IsChecked}">
|
||||
<TextBlock Margin="0,2" Text="什么是工匠精神" />
|
||||
</u:Skeleton>
|
||||
<u:Skeleton
|
||||
VerticalAlignment="Bottom"
|
||||
CornerRadius="2"
|
||||
IsActive="{Binding #s.IsChecked}">
|
||||
<TextBlock Margin="0,2" Text="看山不是山,看水不是水,看山还是山,看水还是水" />
|
||||
</u:Skeleton>
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
14
demo/Ursa.Demo/Pages/SkeletonDemo.axaml.cs
Normal file
14
demo/Ursa.Demo/Pages/SkeletonDemo.axaml.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Avalonia.Controls;
|
||||
using Ursa.Demo.ViewModels;
|
||||
|
||||
namespace Ursa.Demo.Pages
|
||||
{
|
||||
public partial class SkeletonDemo : UserControl
|
||||
{
|
||||
public SkeletonDemo()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = new SkeletonDemoViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,10 @@
|
||||
<ProjectReference Include="..\..\src\Ursa.Themes.Semi\Ursa.Themes.Semi.csproj" />
|
||||
<ProjectReference Include="..\..\src\Ursa\Ursa.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Pages\SkeletonDemo.axaml.cs">
|
||||
<DependentUpon>SkeletonDemo.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyPagination => new PaginationDemoViewModel(),
|
||||
MenuKeys.MenuKeyTagInput => new TagInputDemoViewModel(),
|
||||
MenuKeys.MenuKeyTimeline => new TimelineDemoViewModel(),
|
||||
MenuKeys.MenuKeySkeleton => new SkeletonDemoViewModel(),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class MenuViewModel: ViewModelBase
|
||||
new() { MenuHeader = "Pagination", Key = MenuKeys.MenuKeyPagination },
|
||||
new() { MenuHeader = "TagInput", Key = MenuKeys.MenuKeyTagInput },
|
||||
new() { MenuHeader = "Timeline", Key = MenuKeys.MenuKeyTimeline },
|
||||
new() { MenuHeader = "Skeleton", Key = MenuKeys.MenuKeySkeleton },
|
||||
};
|
||||
}
|
||||
}
|
||||
12
demo/Ursa.Demo/ViewModels/SkeletonDemoViewModel.cs
Normal file
12
demo/Ursa.Demo/ViewModels/SkeletonDemoViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ursa.Demo.ViewModels
|
||||
{
|
||||
public class SkeletonDemoViewModel : ViewModelBase
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user