Refactor into library project
This commit is contained in:
Родитель
7ffc6a023a
Коммит
2fa06c7296
16
Demo.sln
16
Demo.sln
|
@ -1,16 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo", "Demo\Demo.csproj", "{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,8 +0,0 @@
|
|||
.idea/
|
||||
.vscode/
|
||||
.vs/
|
||||
|
||||
bin/
|
||||
obj/
|
||||
|
||||
*.user
|
|
@ -1,24 +0,0 @@
|
|||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace Demo
|
||||
{
|
||||
class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
using Avalonia.Metadata;
|
||||
|
||||
//[assembly: XmlnsDefinition("https://github.com/avaloniaui", "Demo.Controls")]
|
|
@ -1,11 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Demo.ViewModels
|
||||
{
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ItemsRepeaterDataGridDemo", "src\ItemsRepeaterDataGridDemo\ItemsRepeaterDataGridDemo.csproj", "{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ItemsRepeaterDataGrid", "src\ItemsRepeaterDataGrid\ItemsRepeaterDataGrid.csproj", "{941DBB36-F74A-442F-8D4D-F43E6B58F2A9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A2CC1506-A489-4C79-8EF3-FA9B786D1C91}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{941DBB36-F74A-442F-8D4D-F43E6B58F2A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{941DBB36-F74A-442F-8D4D-F43E6B58F2A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{941DBB36-F74A-442F-8D4D-F43E6B58F2A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{941DBB36-F74A-442F-8D4D-F43E6B58F2A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,6 +1,6 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:c="using:Demo.Controls">
|
||||
xmlns:c="using:ItemsRepeaterDataGrid">
|
||||
<Design.PreviewWith>
|
||||
<c:DataGrid/>
|
||||
</Design.PreviewWith>
|
|
@ -3,7 +3,7 @@ using Avalonia;
|
|||
using Avalonia.Collections;
|
||||
using Avalonia.Controls.Primitives;
|
||||
|
||||
namespace Demo.Controls
|
||||
namespace ItemsRepeaterDataGrid
|
||||
{
|
||||
public class DataGrid : TemplatedControl
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Demo.Controls
|
||||
namespace ItemsRepeaterDataGrid
|
||||
{
|
||||
public class DataGridColumn : AvaloniaObject
|
||||
{
|
|
@ -2,7 +2,7 @@ using Avalonia;
|
|||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Metadata;
|
||||
|
||||
namespace Demo.Controls
|
||||
namespace ItemsRepeaterDataGrid
|
||||
{
|
||||
public class DataGridTemplateColumn : DataGridColumn
|
||||
{
|
|
@ -0,0 +1,31 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<IsPackable>True</IsPackable>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>ItemsRepeaterDataGrid</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AnalysisLevel>latest</AnalysisLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>0.10.6</VersionPrefix>
|
||||
<VersionSuffix>preview1</VersionSuffix>
|
||||
<Authors>Wiesław Šoltés</Authors>
|
||||
<Company>Wiesław Šoltés</Company>
|
||||
<Copyright>Copyright © Wiesław Šoltés 2021</Copyright>
|
||||
<PackageProjectUrl>https://github.com/wieslawsoltes/ItemsRepeaterDataGrid</PackageProjectUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<Description>A DataGrid control based on ItemsRepeater panel.</Description>
|
||||
<PackageId>ItemsRepeaterDataGrid</PackageId>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageTags>datagrid;panel;control;xaml;axaml;avalonia;avaloniaui</PackageTags>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.6" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,3 @@
|
|||
using Avalonia.Metadata;
|
||||
|
||||
//[assembly: XmlnsDefinition("https://github.com/avaloniaui", "ItemsRepeaterDataGrid")]
|
|
@ -1,12 +1,12 @@
|
|||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Demo"
|
||||
x:Class="Demo.App">
|
||||
xmlns:local="using:ItemsRepeaterDataGridDemo"
|
||||
x:Class="ItemsRepeaterDataGridDemo.App">
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator />
|
||||
</Application.DataTemplates>
|
||||
<Application.Styles>
|
||||
<FluentTheme Mode="Light" />
|
||||
<StyleInclude Source="/Controls/DataGrid.axaml"></StyleInclude>
|
||||
<StyleInclude Source="avares://ItemsRepeaterDataGrid/DataGrid.axaml"></StyleInclude>
|
||||
</Application.Styles>
|
||||
</Application>
|
|
@ -1,10 +1,10 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Demo.ViewModels;
|
||||
using Demo.Views;
|
||||
using ItemsRepeaterDataGridDemo.ViewModels;
|
||||
using ItemsRepeaterDataGridDemo.Views;
|
||||
|
||||
namespace Demo
|
||||
namespace ItemsRepeaterDataGridDemo
|
||||
{
|
||||
public class App : Application
|
||||
{
|
||||
|
@ -26,4 +26,4 @@ namespace Demo
|
|||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
До Ширина: | Высота: | Размер: 172 KiB После Ширина: | Высота: | Размер: 172 KiB |
|
@ -2,11 +2,15 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<IsPackable>False</IsPackable>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>ItemsRepeaterDataGridDemo</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AnalysisLevel>latest</AnalysisLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
<AvaloniaResource Include="Assets\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -15,4 +19,7 @@
|
|||
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.6" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.6" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ItemsRepeaterDataGrid\ItemsRepeaterDataGrid.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ItemsRepeaterDataGrid;
|
||||
|
||||
namespace ItemsRepeaterDataGridDemo
|
||||
{
|
||||
class Program
|
||||
{
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
GC.KeepAlive(typeof(DataGrid).Assembly);
|
||||
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
|
||||
{
|
||||
return AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Demo.ViewModels;
|
||||
using ItemsRepeaterDataGridDemo.ViewModels;
|
||||
|
||||
namespace Demo
|
||||
namespace ItemsRepeaterDataGridDemo
|
||||
{
|
||||
public class ViewLocator : IDataTemplate
|
||||
{
|
||||
|
@ -29,4 +29,4 @@ namespace Demo
|
|||
return data is ViewModelBase;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using ReactiveUI;
|
||||
|
||||
namespace Demo.ViewModels
|
||||
namespace ItemsRepeaterDataGridDemo.ViewModels
|
||||
{
|
||||
public class ItemViewModel : ViewModelBase
|
||||
{
|
|
@ -3,7 +3,7 @@ using System.Collections.ObjectModel;
|
|||
using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Demo.ViewModels
|
||||
namespace ItemsRepeaterDataGridDemo.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
|
@ -0,0 +1,8 @@
|
|||
using ReactiveUI;
|
||||
|
||||
namespace ItemsRepeaterDataGridDemo.ViewModels
|
||||
{
|
||||
public class ViewModelBase : ReactiveObject
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,47 +1,47 @@
|
|||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Demo.ViewModels"
|
||||
xmlns:vm="using:ItemsRepeaterDataGridDemo.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:c="clr-namespace:Demo.Controls"
|
||||
xmlns:g="clr-namespace:ItemsRepeaterDataGrid;assembly=ItemsRepeaterDataGrid"
|
||||
mc:Ignorable="d" d:DesignWidth="840" d:DesignHeight="480"
|
||||
x:Class="Demo.Views.MainWindow"
|
||||
x:Class="ItemsRepeaterDataGridDemo.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel" x:CompileBindings="True"
|
||||
MinWidth="640" MinHeight="480"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="Demo">
|
||||
Title="ItemsRepeaterDataGridDemo">
|
||||
<Design.DataContext>
|
||||
<vm:MainWindowViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<c:DataGrid Items="{Binding Items}">
|
||||
<c:DataGrid.Columns>
|
||||
<g:DataGrid Items="{Binding Items}">
|
||||
<g:DataGrid.Columns>
|
||||
<!-- Column1 -->
|
||||
<c:DataGridTemplateColumn Header="Column1" Width="150">
|
||||
<c:DataGridTemplateColumn.CellTemplate>
|
||||
<g:DataGridTemplateColumn Header="Column1" Width="150">
|
||||
<g:DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:ItemViewModel">
|
||||
<TextBlock Text="{Binding Column1}" />
|
||||
</DataTemplate>
|
||||
</c:DataGridTemplateColumn.CellTemplate>
|
||||
</c:DataGridTemplateColumn>
|
||||
</g:DataGridTemplateColumn.CellTemplate>
|
||||
</g:DataGridTemplateColumn>
|
||||
<!-- Column2 -->
|
||||
<c:DataGridTemplateColumn Header="Column2" Width="*">
|
||||
<c:DataGridTemplateColumn.CellTemplate>
|
||||
<g:DataGridTemplateColumn Header="Column2" Width="*">
|
||||
<g:DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:ItemViewModel">
|
||||
<TextBlock Text="{Binding Column2}" />
|
||||
</DataTemplate>
|
||||
</c:DataGridTemplateColumn.CellTemplate>
|
||||
</c:DataGridTemplateColumn>
|
||||
</g:DataGridTemplateColumn.CellTemplate>
|
||||
</g:DataGridTemplateColumn>
|
||||
<!-- Column3 -->
|
||||
<c:DataGridTemplateColumn Header="Column3" Width="200">
|
||||
<c:DataGridTemplateColumn.CellTemplate>
|
||||
<g:DataGridTemplateColumn Header="Column3" Width="200">
|
||||
<g:DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate DataType="vm:ItemViewModel">
|
||||
<TextBlock Text="{Binding Column3}" />
|
||||
</DataTemplate>
|
||||
</c:DataGridTemplateColumn.CellTemplate>
|
||||
</c:DataGridTemplateColumn>
|
||||
</c:DataGrid.Columns>
|
||||
</c:DataGrid>
|
||||
</g:DataGridTemplateColumn.CellTemplate>
|
||||
</g:DataGridTemplateColumn>
|
||||
</g:DataGrid.Columns>
|
||||
</g:DataGrid>
|
||||
|
||||
</Window>
|
|
@ -2,7 +2,7 @@ using Avalonia;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Demo.Views
|
||||
namespace ItemsRepeaterDataGridDemo.Views
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
|
@ -19,4 +19,4 @@ namespace Demo.Views
|
|||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче