79 changed files with 0 additions and 2384 deletions
@ -1,46 +0,0 @@ |
|||||
# Autosave files |
|
||||
*~ |
|
||||
|
|
||||
# build |
|
||||
[Oo]bj/ |
|
||||
[Bb]in/ |
|
||||
packages/ |
|
||||
TestResults/ |
|
||||
artifacts/ |
|
||||
|
|
||||
# globs |
|
||||
Makefile.in |
|
||||
*.DS_Store |
|
||||
*.sln.cache |
|
||||
*.suo |
|
||||
*.cache |
|
||||
*.pidb |
|
||||
*.userprefs |
|
||||
*.usertasks |
|
||||
config.log |
|
||||
config.make |
|
||||
config.status |
|
||||
aclocal.m4 |
|
||||
install-sh |
|
||||
autom4te.cache/ |
|
||||
*.user |
|
||||
*.tar.gz |
|
||||
tarballs/ |
|
||||
test-results/ |
|
||||
Thumbs.db |
|
||||
.vs/ |
|
||||
|
|
||||
# Mac bundle stuff |
|
||||
*.dmg |
|
||||
*.app |
|
||||
|
|
||||
# resharper |
|
||||
*_Resharper.* |
|
||||
*.Resharper |
|
||||
|
|
||||
# dotCover |
|
||||
*.dotCover |
|
||||
|
|
||||
src/Avalonia\.Native\.OSX/Avalonia\.Native\.OSX\.xcodeproj/project\.xcworkspace/xcshareddata/IDEWorkspaceChecks\.plist |
|
||||
|
|
||||
src/Avalonia\.Native\.OSX/Avalonia\.Native\.OSX\.xcodeproj/project\.xcworkspace/xcshareddata/WorkspaceSettings\.xcsettings |
|
||||
@ -1,31 +0,0 @@ |
|||||
|
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|
||||
# Visual Studio 15 |
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{250A6353-593D-47E2-A630-E91D882078A9}" |
|
||||
EndProject |
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Native", "src\Avalonia.Native\Avalonia.Native.csproj", "{F9329DCC-62EC-489F-8C13-4FFBF1760E94}" |
|
||||
EndProject |
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{3902AEF7-EA78-44F4-93A9-765DB31C53E5}" |
|
||||
EndProject |
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog", "samples\ControlCatalog\ControlCatalog.csproj", "{D5FA1304-DD4F-419E-89ED-AAD1E5FDE020}" |
|
||||
EndProject |
|
||||
Global |
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
||||
Debug|Any CPU = Debug|Any CPU |
|
||||
Release|Any CPU = Release|Any CPU |
|
||||
EndGlobalSection |
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|
||||
{F9329DCC-62EC-489F-8C13-4FFBF1760E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{F9329DCC-62EC-489F-8C13-4FFBF1760E94}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{F9329DCC-62EC-489F-8C13-4FFBF1760E94}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{F9329DCC-62EC-489F-8C13-4FFBF1760E94}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
{D5FA1304-DD4F-419E-89ED-AAD1E5FDE020}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||
{D5FA1304-DD4F-419E-89ED-AAD1E5FDE020}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||
{D5FA1304-DD4F-419E-89ED-AAD1E5FDE020}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||
{D5FA1304-DD4F-419E-89ED-AAD1E5FDE020}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||
EndGlobalSection |
|
||||
GlobalSection(NestedProjects) = preSolution |
|
||||
{F9329DCC-62EC-489F-8C13-4FFBF1760E94} = {250A6353-593D-47E2-A630-E91D882078A9} |
|
||||
{D5FA1304-DD4F-419E-89ED-AAD1E5FDE020} = {3902AEF7-EA78-44F4-93A9-765DB31C53E5} |
|
||||
EndGlobalSection |
|
||||
EndGlobal |
|
||||
@ -1,14 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<configuration> |
|
||||
<packageRestore> |
|
||||
<add key="enabled" value="True" /> |
|
||||
<add key="automatic" value="True" /> |
|
||||
</packageRestore> |
|
||||
<packageSources> |
|
||||
<add key="NuGet 3 (plain)" value="http://api.nuget.org/v3/index.json" /> |
|
||||
<add key="Avalonia Nightly" value="https://www.myget.org/F/avalonia-ci/api/v2" /> |
|
||||
</packageSources> |
|
||||
<bindingRedirects> |
|
||||
<add key="skip" value="False" /> |
|
||||
</bindingRedirects> |
|
||||
</configuration> |
|
||||
@ -1,6 +0,0 @@ |
|||||
# Avalonia.Native |
|
||||
Native libraries that implement Avalonia backends in native code, exposed with COM abi. |
|
||||
|
|
||||
[](https://dev.azure.com/AvaloniaUI/avaloniaui.net/_build/latest?definitionId=3) |
|
||||
|
|
||||
 |
|
||||
@ -1,28 +0,0 @@ |
|||||
|
|
||||
pool: |
|
||||
vmImage: 'macOS 10.13' |
|
||||
|
|
||||
steps: |
|
||||
- bash: 'xcodebuild -showsdks' |
|
||||
- task: Xcode@5 |
|
||||
inputs: |
|
||||
actions: 'build' |
|
||||
scheme: '' |
|
||||
sdk: 'macosx10.13' |
|
||||
configuration: 'Release' |
|
||||
xcWorkspacePath: '**/*.xcodeproj/project.xcworkspace' |
|
||||
xcodeVersion: 'default' # Options: 8, 9, default, specifyPath |
|
||||
args: '-derivedDataPath ./' |
|
||||
- task: DotNetCoreInstaller@0 |
|
||||
inputs: |
|
||||
version: '2.1.401' |
|
||||
- script: | |
|
||||
brew install castxml |
|
||||
export COREHOST_TRACE=0 |
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 |
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1 |
|
||||
which dotnet |
|
||||
dotnet --info |
|
||||
dotnet tool install -g Cake.Tool --version 0.30.0 |
|
||||
export PATH="$PATH:$HOME/.dotnet/tools" |
|
||||
dotnet cake build.cake -Target="Azure" -Platform="Any CPU" -Configuration="Release" |
|
||||
@ -1,148 +0,0 @@ |
|||||
#load "./parameters.cake" |
|
||||
|
|
||||
Setup<Parameters>(context => |
|
||||
{ |
|
||||
Information("Running tasks..."); |
|
||||
return new Parameters(context); |
|
||||
}); |
|
||||
|
|
||||
Teardown<Parameters>((context, parameters) => |
|
||||
{ |
|
||||
Information("Finished running tasks."); |
|
||||
}); |
|
||||
|
|
||||
Task("Clean") |
|
||||
.Does<Parameters>(parameters => |
|
||||
{ |
|
||||
foreach(var project in parameters.BuildProjects) |
|
||||
{ |
|
||||
(string path, string name) = project; |
|
||||
Information($"Clean: {name}"); |
|
||||
DotNetCoreClean($"{path}/{name}/{name}.csproj", new DotNetCoreCleanSettings { |
|
||||
Configuration = parameters.Configuration, |
|
||||
Verbosity = DotNetCoreVerbosity.Minimal |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
Task("Build") |
|
||||
.Does<Parameters>(parameters => |
|
||||
{ |
|
||||
foreach(var project in parameters.BuildProjects) |
|
||||
{ |
|
||||
(string path, string name) = project; |
|
||||
Information($"Build: {name}"); |
|
||||
DotNetCoreBuild($"{path}/{name}/{name}.csproj", new DotNetCoreBuildSettings { |
|
||||
Configuration = parameters.Configuration, |
|
||||
VersionSuffix = parameters.VersionSuffix |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
Task("Test") |
|
||||
.Does<Parameters>(parameters => |
|
||||
{ |
|
||||
foreach(var project in parameters.TestProjects) |
|
||||
{ |
|
||||
(string path, string name) = project; |
|
||||
Information($"Test: {name}"); |
|
||||
DotNetCoreTest($"{path}/{name}/{name}.csproj", new DotNetCoreTestSettings { |
|
||||
Configuration = parameters.Configuration |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
Task("Publish") |
|
||||
.Does<Parameters>(parameters => |
|
||||
{ |
|
||||
CleanDirectory($"{parameters.Artifacts}/zip"); |
|
||||
var redistVersion = "14.15.26706"; |
|
||||
var redistPath = $"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\{redistVersion}\\x64\\Microsoft.VC141.CRT\\"; |
|
||||
var redistRuntime = "win7-x64"; |
|
||||
foreach(var project in parameters.PublishProjects) |
|
||||
{ |
|
||||
(string path, string name, string framework, string runtime) = project; |
|
||||
var output = $"./{parameters.Artifacts}/publish/{name}-{framework}-{runtime}"; |
|
||||
Information($"Publish: {name}, {framework}, {runtime}"); |
|
||||
DotNetCorePublish($"{path}/{name}/{name}.csproj", new DotNetCorePublishSettings { |
|
||||
Configuration = parameters.Configuration, |
|
||||
VersionSuffix = parameters.VersionSuffix, |
|
||||
Framework = framework, |
|
||||
Runtime = runtime, |
|
||||
OutputDirectory = output |
|
||||
}); |
|
||||
if (string.Compare(runtime, redistRuntime, StringComparison.OrdinalIgnoreCase) == 0) |
|
||||
{ |
|
||||
CopyFileToDirectory($"{redistPath}msvcp140.dll", output); |
|
||||
CopyFileToDirectory($"{redistPath}vcruntime140.dll", output); |
|
||||
} |
|
||||
Zip($"{parameters.Artifacts}/publish/{name}-{framework}-{runtime}", $"{parameters.Artifacts}/zip/{name}-{framework}-{runtime}.zip"); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
Task("Pack") |
|
||||
.Does<Parameters>(parameters => |
|
||||
{ |
|
||||
CleanDirectory($"{parameters.Artifacts}/nuget"); |
|
||||
foreach(var project in parameters.PackProjects) |
|
||||
{ |
|
||||
(string path, string name) = project; |
|
||||
Information($"Pack: {name}"); |
|
||||
DotNetCorePack($"{path}/{name}/{name}.csproj", new DotNetCorePackSettings { |
|
||||
Configuration = parameters.Configuration, |
|
||||
VersionSuffix = "parameters.VersionSuffix", |
|
||||
OutputDirectory = $"{parameters.Artifacts}/nuget", |
|
||||
EnvironmentVariables = new Dictionary<string, string> |
|
||||
{ |
|
||||
{ "VERSION", parameters.Version } |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
Task("Push") |
|
||||
.WithCriteria<Parameters>((context, parameters) => parameters.PushNuGet) |
|
||||
.Does<Parameters>(parameters => |
|
||||
{ |
|
||||
var apiKey = EnvironmentVariable(parameters.IsNugetRelease ? "NUGET_API_KEY" : "MYGET_API_KEY"); |
|
||||
var apiUrl = EnvironmentVariable(parameters.IsNugetRelease ? "NUGET_API_URL" : "MYGET_API_URL"); |
|
||||
var packages = GetFiles($"{parameters.Artifacts}/nuget/*.nupkg"); |
|
||||
foreach (var package in packages) |
|
||||
{ |
|
||||
DotNetCoreNuGetPush(package.FullPath, new DotNetCoreNuGetPushSettings { |
|
||||
Source = apiUrl, |
|
||||
ApiKey = apiKey |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
Task("Default") |
|
||||
.IsDependentOn("Build"); |
|
||||
|
|
||||
Task("AppVeyor") |
|
||||
.IsDependentOn("Clean") |
|
||||
.IsDependentOn("Build") |
|
||||
.IsDependentOn("Test") |
|
||||
.IsDependentOn("Publish") |
|
||||
.IsDependentOn("Pack") |
|
||||
.IsDependentOn("Push"); |
|
||||
|
|
||||
Task("Travis") |
|
||||
.IsDependentOn("Test"); |
|
||||
|
|
||||
Task("CircleCI") |
|
||||
.IsDependentOn("Test"); |
|
||||
|
|
||||
Task("Azure") |
|
||||
.IsDependentOn("Clean") |
|
||||
.IsDependentOn("Build") |
|
||||
.IsDependentOn("Pack") |
|
||||
.IsDependentOn("Push"); |
|
||||
|
|
||||
Task("Azure-macOS") |
|
||||
.IsDependentOn("Test"); |
|
||||
|
|
||||
Task("Azure-Linux") |
|
||||
.IsDependentOn("Test"); |
|
||||
|
|
||||
RunTarget(Context.Argument("target", "Default")); |
|
||||
@ -1,74 +0,0 @@ |
|||||
|
|
||||
public class Parameters |
|
||||
{ |
|
||||
public string Configuration { get; private set; } |
|
||||
public string Artifacts { get; private set; } |
|
||||
public string VersionSuffix { get; private set; } |
|
||||
public string Version { get; private set; } = "0.7.0"; |
|
||||
public string NuGetPushBranch { get; private set; } |
|
||||
public string NuGetPushRepoName { get; private set; } |
|
||||
public bool PushNuGet { get; private set; } |
|
||||
public bool IsNugetRelease { get; private set; } |
|
||||
public (string path, string name)[] BuildProjects { get; private set; } |
|
||||
public (string path, string name)[] TestProjects { get; private set; } |
|
||||
public (string path, string name, string framework, string runtime)[] PublishProjects { get; private set; } |
|
||||
public (string path, string name)[] PackProjects { get; private set; } |
|
||||
|
|
||||
public Parameters(ICakeContext context) |
|
||||
{ |
|
||||
Configuration = context.Argument("configuration", "Release"); |
|
||||
Artifacts = context.Argument("artifacts", "./artifacts"); |
|
||||
|
|
||||
VersionSuffix = context.Argument("suffix", default(string)); |
|
||||
if (VersionSuffix == null) |
|
||||
{ |
|
||||
var build = context.EnvironmentVariable("BUILD_BUILDNUMBER"); |
|
||||
VersionSuffix = build != null ? $"-build{build}" : ""; |
|
||||
} |
|
||||
|
|
||||
Version += "-build4" + context.EnvironmentVariable("BUILD_BUILDNUMBER").Replace(".",""); |
|
||||
|
|
||||
NuGetPushBranch = "master"; |
|
||||
NuGetPushRepoName = "https://github.com/AvaloniaUI/Avalonia.Native"; |
|
||||
|
|
||||
var repoName = context.EnvironmentVariable("BUILD_REPOSITORY_URI"); |
|
||||
var repoBranch = context.EnvironmentVariable("BUILD_SOURCEBRANCHNAME"); |
|
||||
var repoTag = context.EnvironmentVariable("APPVEYOR_REPO_TAG"); |
|
||||
var repoTagName = context.EnvironmentVariable("APPVEYOR_REPO_TAG_NAME"); |
|
||||
var pullRequestTitle = context.EnvironmentVariable("SYSTEM_PULLREQUEST_SOURCEBRANCH"); |
|
||||
|
|
||||
System.Console.WriteLine($"RepoName: {repoName}, RepoBranch: {repoBranch}, PR Title: {pullRequestTitle}/."); |
|
||||
|
|
||||
if (pullRequestTitle == null |
|
||||
&& string.Compare(repoName, NuGetPushRepoName, StringComparison.OrdinalIgnoreCase) == 0 |
|
||||
&& string.Compare(repoBranch, NuGetPushBranch, StringComparison.OrdinalIgnoreCase) == 0) |
|
||||
{ |
|
||||
PushNuGet = true; |
|
||||
} |
|
||||
|
|
||||
if (pullRequestTitle == null |
|
||||
&& string.Compare(repoTag, "True", StringComparison.OrdinalIgnoreCase) == 0 |
|
||||
&& repoTagName != null) |
|
||||
{ |
|
||||
IsNugetRelease = true; |
|
||||
} |
|
||||
|
|
||||
BuildProjects = new [] |
|
||||
{ |
|
||||
( "./src", "Avalonia.Native" ) |
|
||||
}; |
|
||||
|
|
||||
TestProjects = new (string path, string name) [] |
|
||||
{ |
|
||||
}; |
|
||||
|
|
||||
PublishProjects = new (string path, string name, string framework, string runtime) [] |
|
||||
{ |
|
||||
}; |
|
||||
|
|
||||
PackProjects = new [] |
|
||||
{ |
|
||||
( "./src", "Avalonia.Native" ) |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<configuration> |
|
||||
<startup> |
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> |
|
||||
</startup> |
|
||||
<runtime> |
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
|
||||
<dependentAssembly> |
|
||||
<assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" /> |
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> |
|
||||
</dependentAssembly> |
|
||||
<dependentAssembly> |
|
||||
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" /> |
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.2.0" newVersion="3.0.2.0" /> |
|
||||
</dependentAssembly> |
|
||||
<dependentAssembly> |
|
||||
<assemblyIdentity name="SharpDX.DXGI" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" /> |
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.2.0" newVersion="3.0.2.0" /> |
|
||||
</dependentAssembly> |
|
||||
</assemblyBinding> |
|
||||
</runtime> |
|
||||
</configuration> |
|
||||
@ -1,19 +0,0 @@ |
|||||
<Application xmlns="https://github.com/avaloniaui"> |
|
||||
<Application.Styles> |
|
||||
<StyleInclude Source="resm:Avalonia.Themes.Default.DefaultTheme.xaml?assembly=Avalonia.Themes.Default"/> |
|
||||
<StyleInclude Source="resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"/> |
|
||||
|
|
||||
<Style Selector="TextBlock.h1"> |
|
||||
<Setter Property="Foreground" Value="#212121"/> |
|
||||
<Setter Property="FontSize" Value="20"/> |
|
||||
<Setter Property="FontWeight" Value="Medium"/> |
|
||||
</Style> |
|
||||
|
|
||||
<Style Selector="TextBlock.h2"> |
|
||||
<Setter Property="Foreground" Value="#727272"/> |
|
||||
<Setter Property="FontSize" Value="13"/> |
|
||||
</Style> |
|
||||
|
|
||||
<StyleInclude Source="resm:ControlCatalog.SideBar.xaml"/> |
|
||||
</Application.Styles> |
|
||||
</Application> |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Avalonia; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog |
|
||||
{ |
|
||||
public class App : Application |
|
||||
{ |
|
||||
public override void Initialize() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 212 KiB |
|
Before Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 172 KiB |
@ -1,21 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<OutputType>Exe</OutputType> |
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.6.2-build6362-beta" /> |
|
||||
<EmbeddedResource Include="**/*.xaml" /> |
|
||||
<EmbeddedResource Include="**/*.png" /> |
|
||||
<EmbeddedResource Include="**/*.jpg" /> |
|
||||
<EmbeddedResource Include="**/*.ico" /> |
|
||||
|
|
||||
|
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Native\Avalonia.Native.csproj" /> |
|
||||
</ItemGroup> |
|
||||
</Project> |
|
||||
@ -1,33 +0,0 @@ |
|||||
<Window xmlns="https://github.com/avaloniaui" MinWidth="500" MinHeight="300" |
|
||||
Title="Avalonia Control Gallery" |
|
||||
Icon="resm:ControlCatalog.Assets.test_icon.ico" |
|
||||
xmlns:local="clr-namespace:ControlCatalog" HasSystemDecorations="False"> |
|
||||
<Grid RowDefinitions="5,*,5" ColumnDefinitions="5,*,5"> |
|
||||
<DockPanel Grid.Column="1" Grid.Row="1" > |
|
||||
<Grid Name="TitleBar" Background="LightBlue" DockPanel.Dock="Top" ColumnDefinitions="Auto,*,Auto"> |
|
||||
<TextBlock VerticalAlignment="Center" Margin="5,0,0,0">Title</TextBlock> |
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal"> |
|
||||
<StackPanel.Styles> |
|
||||
<Style Selector="Button"> |
|
||||
<Setter Property="Margin" Value="2"/> |
|
||||
</Style> |
|
||||
</StackPanel.Styles> |
|
||||
<Button Name="MinimizeButton">_</Button> |
|
||||
<Button Name="MaximizeButton">[ ]</Button> |
|
||||
<Button Name="CloseButton">X</Button> |
|
||||
</StackPanel> |
|
||||
</Grid> |
|
||||
<Border Background="White" Margin="5"> |
|
||||
<TextBlock>Hello world!</TextBlock> |
|
||||
</Border> |
|
||||
</DockPanel> |
|
||||
<Border Name="TopLeft" Background="Red"/> |
|
||||
<Border Name="TopRight" Background="Red" Grid.Column="2" /> |
|
||||
<Border Name="BottomLeft" Background="Red" Grid.Row="2" /> |
|
||||
<Border Name="BottomRight" Background="Red" Grid.Row="2" Grid.Column="2"/> |
|
||||
<Border Name="Top" Background="Blue" Grid.Column="1" /> |
|
||||
<Border Name="Right" Background="Blue" Grid.Row="1" Grid.Column="2" /> |
|
||||
<Border Name="Bottom" Background="Blue" Grid.Row="2" Grid.Column="1" /> |
|
||||
<Border Name="Left" Background="Blue" Grid.Row="1" /> |
|
||||
</Grid> |
|
||||
</Window> |
|
||||
@ -1,53 +0,0 @@ |
|||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using System; |
|
||||
using Avalonia.Input; |
|
||||
|
|
||||
namespace ControlCatalog |
|
||||
{ |
|
||||
public class DecoratedWindow : Window |
|
||||
{ |
|
||||
public DecoratedWindow() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
this.AttachDevTools(); |
|
||||
} |
|
||||
|
|
||||
void SetupSide(string name, StandardCursorType cursor, WindowEdge edge) |
|
||||
{ |
|
||||
var ctl = this.FindControl<Control>(name); |
|
||||
ctl.Cursor = new Cursor(cursor); |
|
||||
ctl.PointerPressed += delegate |
|
||||
{ |
|
||||
PlatformImpl?.BeginResizeDrag(edge); |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
this.FindControl<Control>("TitleBar").PointerPressed += delegate |
|
||||
{ |
|
||||
PlatformImpl?.BeginMoveDrag(); |
|
||||
}; |
|
||||
SetupSide("Left", StandardCursorType.LeftSide, WindowEdge.West); |
|
||||
SetupSide("Right", StandardCursorType.RightSide, WindowEdge.East); |
|
||||
SetupSide("Top", StandardCursorType.TopSide, WindowEdge.North); |
|
||||
SetupSide("Bottom", StandardCursorType.BottomSize, WindowEdge.South); |
|
||||
SetupSide("TopLeft", StandardCursorType.TopLeftCorner, WindowEdge.NorthWest); |
|
||||
SetupSide("TopRight", StandardCursorType.TopRightCorner, WindowEdge.NorthEast); |
|
||||
SetupSide("BottomLeft", StandardCursorType.BottomLeftCorner, WindowEdge.SouthWest); |
|
||||
SetupSide("BottomRight", StandardCursorType.BottomRightCorner, WindowEdge.SouthEast); |
|
||||
this.FindControl<Button>("MinimizeButton").Click += delegate { this.WindowState = WindowState.Minimized; }; |
|
||||
this.FindControl<Button>("MaximizeButton").Click += delegate |
|
||||
{ |
|
||||
WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; |
|
||||
}; |
|
||||
this.FindControl<Button>("CloseButton").Click += delegate |
|
||||
{ |
|
||||
Close(); |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:pages="clr-namespace:ControlCatalog.Pages" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<TabControl Classes="sidebar" Name="Sidebar"> |
|
||||
<TabControl.PageTransition> |
|
||||
<CrossFade Duration="0.25"/> |
|
||||
</TabControl.PageTransition> |
|
||||
<TabItem Header="AutoCompleteBox"><pages:AutoCompleteBoxPage/></TabItem> |
|
||||
<TabItem Header="Border"><pages:BorderPage/></TabItem> |
|
||||
<TabItem Header="Button"><pages:ButtonPage/></TabItem> |
|
||||
<TabItem Header="ButtonSpinner"><pages:ButtonSpinnerPage/></TabItem> |
|
||||
<TabItem Header="Calendar"><pages:CalendarPage/></TabItem> |
|
||||
<TabItem Header="Canvas"><pages:CanvasPage/></TabItem> |
|
||||
<TabItem Header="Carousel"><pages:CarouselPage/></TabItem> |
|
||||
<TabItem Header="CheckBox"><pages:CheckBoxPage/></TabItem> |
|
||||
<TabItem Header="ContextMenu"><pages:ContextMenuPage/></TabItem> |
|
||||
<TabItem Header="DatePicker"><pages:DatePickerPage/></TabItem> |
|
||||
<TabItem Header="Drag+Drop"><pages:DragAndDropPage/></TabItem> |
|
||||
<TabItem Header="DropDown"><pages:DropDownPage/></TabItem> |
|
||||
<TabItem Header="Expander"><pages:ExpanderPage/></TabItem> |
|
||||
<TabItem Header="Image"><pages:ImagePage/></TabItem> |
|
||||
<TabItem Header="LayoutTransformControl"><pages:LayoutTransformControlPage/></TabItem> |
|
||||
<TabItem Header="ListBox"><pages:ListBoxPage/></TabItem> |
|
||||
<TabItem Header="Menu"><pages:MenuPage/></TabItem> |
|
||||
<TabItem Header="ProgressBar"><pages:ProgressBarPage/></TabItem> |
|
||||
<TabItem Header="RadioButton"><pages:RadioButtonPage/></TabItem> |
|
||||
<TabItem Header="Slider"><pages:SliderPage/></TabItem> |
|
||||
<TabItem Header="TextBox"><pages:TextBoxPage/></TabItem> |
|
||||
<TabItem Header="ToolTip"><pages:ToolTipPage/></TabItem> |
|
||||
<TabItem Header="TreeView"><pages:TreeViewPage/></TabItem> |
|
||||
</TabControl> |
|
||||
</UserControl> |
|
||||
@ -1,37 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using Avalonia.Platform; |
|
||||
using ControlCatalog.Pages; |
|
||||
|
|
||||
namespace ControlCatalog |
|
||||
{ |
|
||||
public class MainView : UserControl |
|
||||
{ |
|
||||
public MainView() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
if (AvaloniaLocator.Current.GetService<IRuntimePlatform>().GetRuntimeInfo().IsDesktop) |
|
||||
{ |
|
||||
IList tabItems = ((IList)this.FindControl<TabControl>("Sidebar").Items); |
|
||||
tabItems.Add(new TabItem() |
|
||||
{ |
|
||||
Header = "Dialogs", |
|
||||
Content = new DialogsPage() |
|
||||
}); |
|
||||
tabItems.Add(new TabItem() |
|
||||
{ |
|
||||
Header = "Screens", |
|
||||
Content = new ScreenPage() |
|
||||
}); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
<Window xmlns="https://github.com/avaloniaui" MinWidth="500" MinHeight="300" |
|
||||
Title="Avalonia Control Gallery" |
|
||||
Icon="resm:ControlCatalog.Assets.test_icon.ico?assembly=ControlCatalog" |
|
||||
xmlns:local="clr-namespace:ControlCatalog"> |
|
||||
<local:MainView/> |
|
||||
</Window> |
|
||||
@ -1,28 +0,0 @@ |
|||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using System; |
|
||||
|
|
||||
namespace ControlCatalog |
|
||||
{ |
|
||||
public class MainWindow : Window |
|
||||
{ |
|
||||
public MainWindow() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
this.AttachDevTools(); |
|
||||
//Renderer.DrawFps = true;
|
|
||||
//Renderer.DrawDirtyRects = Renderer.DrawFps = true;
|
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
// TODO: iOS does not support dynamically loading assemblies
|
|
||||
// so we must refer to this resource DLL statically. For
|
|
||||
// now I am doing that here. But we need a better solution!!
|
|
||||
var theme = new Avalonia.Themes.Default.DefaultTheme(); |
|
||||
theme.TryGetResource("Button", out _); |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,59 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">AutoCompleteBox</TextBlock> |
|
||||
<TextBlock Classes="h2">A control into which the user can input text</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="8"> |
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock Text="MinimumPrefixLength: 1"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
MinimumPrefixLength="1"/> |
|
||||
<TextBlock Text="MinimumPrefixLength: 3"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
MinimumPrefixLength="3"/> |
|
||||
<TextBlock Text="MinimumPopulateDelay: 1 Second"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
MinimumPopulateDelay="1"/> |
|
||||
<TextBlock Text="MaxDropDownHeight: 60"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
MaxDropDownHeight="60"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
Watermark="Watermark"/> |
|
||||
<TextBlock Text="Disabled"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
IsEnabled="False"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
|
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
|
|
||||
<TextBlock Text="ValueMemeberSelector"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
ValueMemberSelector="Capital"/> |
|
||||
<TextBlock Text="ValueMemberBinding"/> |
|
||||
<AutoCompleteBox Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
ValueMemberBinding="{Binding Capital}"/> |
|
||||
<TextBlock Text="Multi-Binding"/> |
|
||||
<AutoCompleteBox Name="MultiBindingBox" |
|
||||
Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
FilterMode="Contains"/> |
|
||||
<TextBlock Text="Async Populate"/> |
|
||||
<AutoCompleteBox Name="AsyncBox" |
|
||||
Width="200" |
|
||||
Margin="0,0,0,8" |
|
||||
FilterMode="None"/> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,145 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.LogicalTree; |
|
||||
using Avalonia.Markup; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using Avalonia.Markup.Data; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
using Avalonia.Data.Converters; |
|
||||
using Avalonia.Data; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class AutoCompleteBoxPage : UserControl |
|
||||
{ |
|
||||
public class StateData |
|
||||
{ |
|
||||
public string Name { get; private set; } |
|
||||
public string Abbreviation { get; private set; } |
|
||||
public string Capital { get; private set; } |
|
||||
|
|
||||
public StateData(string name, string abbreviatoin, string capital) |
|
||||
{ |
|
||||
Name = name; |
|
||||
Abbreviation = abbreviatoin; |
|
||||
Capital = capital; |
|
||||
} |
|
||||
|
|
||||
public override string ToString() |
|
||||
{ |
|
||||
return Name; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private StateData[] BuildAllStates() |
|
||||
{ |
|
||||
return new StateData[] |
|
||||
{ |
|
||||
new StateData("Alabama","AL","Montgomery"), |
|
||||
new StateData("Alaska","AK","Juneau"), |
|
||||
new StateData("Arizona","AZ","Phoenix"), |
|
||||
new StateData("Arkansas","AR","Little Rock"), |
|
||||
new StateData("California","CA","Sacramento"), |
|
||||
new StateData("Colorado","CO","Denver"), |
|
||||
new StateData("Connecticut","CT","Hartford"), |
|
||||
new StateData("Delaware","DE","Dover"), |
|
||||
new StateData("Florida","FL","Tallahassee"), |
|
||||
new StateData("Georgia","GA","Atlanta"), |
|
||||
new StateData("Hawaii","HI","Honolulu"), |
|
||||
new StateData("Idaho","ID","Boise"), |
|
||||
new StateData("Illinois","IL","Springfield"), |
|
||||
new StateData("Indiana","IN","Indianapolis"), |
|
||||
new StateData("Iowa","IA","Des Moines"), |
|
||||
new StateData("Kansas","KS","Topeka"), |
|
||||
new StateData("Kentucky","KY","Frankfort"), |
|
||||
new StateData("Louisiana","LA","Baton Rouge"), |
|
||||
new StateData("Maine","ME","Augusta"), |
|
||||
new StateData("Maryland","MD","Annapolis"), |
|
||||
new StateData("Massachusetts","MA","Boston"), |
|
||||
new StateData("Michigan","MI","Lansing"), |
|
||||
new StateData("Minnesota","MN","St. Paul"), |
|
||||
new StateData("Mississippi","MS","Jackson"), |
|
||||
new StateData("Missouri","MO","Jefferson City"), |
|
||||
new StateData("Montana","MT","Helena"), |
|
||||
new StateData("Nebraska","NE","Lincoln"), |
|
||||
new StateData("Nevada","NV","Carson City"), |
|
||||
new StateData("New Hampshire","NH","Concord"), |
|
||||
new StateData("New Jersey","NJ","Trenton"), |
|
||||
new StateData("New Mexico","NM","Santa Fe"), |
|
||||
new StateData("New York","NY","Albany"), |
|
||||
new StateData("North Carolina","NC","Raleigh"), |
|
||||
new StateData("North Dakota","ND","Bismarck"), |
|
||||
new StateData("Ohio","OH","Columbus"), |
|
||||
new StateData("Oklahoma","OK","Oklahoma City"), |
|
||||
new StateData("Oregon","OR","Salem"), |
|
||||
new StateData("Pennsylvania","PA","Harrisburg"), |
|
||||
new StateData("Rhode Island","RI","Providence"), |
|
||||
new StateData("South Carolina","SC","Columbia"), |
|
||||
new StateData("South Dakota","SD","Pierre"), |
|
||||
new StateData("Tennessee","TN","Nashville"), |
|
||||
new StateData("Texas","TX","Austin"), |
|
||||
new StateData("Utah","UT","Salt Lake City"), |
|
||||
new StateData("Vermont","VT","Montpelier"), |
|
||||
new StateData("Virginia","VA","Richmond"), |
|
||||
new StateData("Washington","WA","Olympia"), |
|
||||
new StateData("West Virginia","WV","Charleston"), |
|
||||
new StateData("Wisconsin","WI","Madison"), |
|
||||
new StateData("Wyoming","WY","Cheyenne"), |
|
||||
}; |
|
||||
} |
|
||||
public StateData[] States { get; private set; } |
|
||||
|
|
||||
public AutoCompleteBoxPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
|
|
||||
States = BuildAllStates(); |
|
||||
|
|
||||
foreach (AutoCompleteBox box in GetAllAutoCompleteBox()) |
|
||||
{ |
|
||||
box.Items = States; |
|
||||
} |
|
||||
|
|
||||
var converter = new FuncMultiValueConverter<string, string>(parts => |
|
||||
{ |
|
||||
return String.Format("{0} ({1})", parts.ToArray()); |
|
||||
}); |
|
||||
var binding = new MultiBinding { Converter = converter }; |
|
||||
binding.Bindings.Add(new Binding("Name")); |
|
||||
binding.Bindings.Add(new Binding("Abbreviation")); |
|
||||
|
|
||||
var multibindingBox = this.FindControl<AutoCompleteBox>("MultiBindingBox"); |
|
||||
multibindingBox.ValueMemberBinding = binding; |
|
||||
|
|
||||
var asyncBox = this.FindControl<AutoCompleteBox>("AsyncBox"); |
|
||||
asyncBox.AsyncPopulator = PopulateAsync; |
|
||||
} |
|
||||
private IEnumerable<AutoCompleteBox> GetAllAutoCompleteBox() |
|
||||
{ |
|
||||
return |
|
||||
this.GetLogicalDescendants() |
|
||||
.OfType<AutoCompleteBox>(); |
|
||||
} |
|
||||
|
|
||||
private bool StringContains(string str, string query) |
|
||||
{ |
|
||||
return str.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0; |
|
||||
} |
|
||||
private async Task<IEnumerable<object>> PopulateAsync(string searchText, CancellationToken cancellationToken) |
|
||||
{ |
|
||||
await Task.Delay(TimeSpan.FromSeconds(1.5), cancellationToken); |
|
||||
|
|
||||
return |
|
||||
States.Where(data => StringContains(data.Name, searchText) || StringContains(data.Capital, searchText)) |
|
||||
.ToList(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Border</TextBlock> |
|
||||
<TextBlock Classes="h2">A control which decorates a child with a border and background</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<Border BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="2" Padding="16"> |
|
||||
<TextBlock>Border</TextBlock> |
|
||||
</Border> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush2}" |
|
||||
BorderBrush="{DynamicResource ThemeAccentBrush}" |
|
||||
BorderThickness="4" |
|
||||
Padding="16"> |
|
||||
<TextBlock>Border and Background</TextBlock> |
|
||||
</Border> |
|
||||
<Border BorderBrush="{DynamicResource ThemeAccentBrush}" |
|
||||
BorderThickness="4" |
|
||||
CornerRadius="8" |
|
||||
Padding="16"> |
|
||||
<TextBlock>Rounded Corners</TextBlock> |
|
||||
</Border> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush2}" |
|
||||
CornerRadius="8" |
|
||||
Padding="16"> |
|
||||
<TextBlock>Rounded Corners</TextBlock> |
|
||||
</Border> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class BorderPage : UserControl |
|
||||
{ |
|
||||
public BorderPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,36 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Button</TextBlock> |
|
||||
<TextBlock Classes="h2">A button control</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="8" Width="150"> |
|
||||
<Button>Button</Button> |
|
||||
<Button Foreground="White">Foreground</Button> |
|
||||
<Button Background="{DynamicResource ThemeAccentBrush}">Background</Button> |
|
||||
<Button IsEnabled="False">Disabled</Button> |
|
||||
<Button Content="Re-themed"> |
|
||||
<Button.Styles> |
|
||||
<Style> |
|
||||
<Style.Resources> |
|
||||
<SolidColorBrush x:Key="ThemeBorderMidBrush">Red</SolidColorBrush> |
|
||||
<SolidColorBrush x:Key="ThemeControlDarkBrush">DarkRed</SolidColorBrush> |
|
||||
</Style.Resources> |
|
||||
</Style> |
|
||||
</Button.Styles> |
|
||||
</Button> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" Spacing="8" Width="150"> |
|
||||
<Button BorderThickness="0">No Border</Button> |
|
||||
<Button BorderBrush="{DynamicResource ThemeAccentBrush}">Border Color</Button> |
|
||||
<Button BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="4">Thick Border</Button> |
|
||||
<Button BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="4" IsEnabled="False">Disabled</Button> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ButtonPage : UserControl |
|
||||
{ |
|
||||
public ButtonPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,24 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">ButtonSpinner</TextBlock> |
|
||||
<TextBlock Classes="h2">The ButtonSpinner control allows you to add button spinners to any element and then respond to the Spin event to manipulate that element.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" Spacing="8" Width="200" Margin="0,20,0,0"> |
|
||||
<CheckBox Name="allowSpinCheck" IsChecked="True">AllowSpin</CheckBox> |
|
||||
<CheckBox Name="showSpinCheck" IsChecked="True">ShowButtonSpinner</CheckBox> |
|
||||
<ButtonSpinner Spin="OnSpin" Height="30" |
|
||||
AllowSpin="{Binding #allowSpinCheck.IsChecked}" |
|
||||
ShowButtonSpinner="{Binding #showSpinCheck.IsChecked}"> |
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Everest"/> |
|
||||
</ButtonSpinner> |
|
||||
<ButtonSpinner Spin="OnSpin" Height="30" ButtonSpinnerLocation="Left" |
|
||||
AllowSpin="{Binding #allowSpinCheck.IsChecked}" |
|
||||
ShowButtonSpinner="{Binding #showSpinCheck.IsChecked}"> |
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Everest"/> |
|
||||
</ButtonSpinner> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
|
|
||||
</UserControl> |
|
||||
@ -1,54 +0,0 @@ |
|||||
using System; |
|
||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Interactivity; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ButtonSpinnerPage : UserControl |
|
||||
{ |
|
||||
public ButtonSpinnerPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
|
|
||||
private void OnSpin(object sender, SpinEventArgs e) |
|
||||
{ |
|
||||
var spinner = (ButtonSpinner)sender; |
|
||||
var txtBox = (TextBlock)spinner.Content; |
|
||||
|
|
||||
int value = Array.IndexOf(_mountains, txtBox.Text); |
|
||||
if (e.Direction == SpinDirection.Increase) |
|
||||
value++; |
|
||||
else |
|
||||
value--; |
|
||||
|
|
||||
if (value < 0) |
|
||||
value = _mountains.Length - 1; |
|
||||
else if (value >= _mountains.Length) |
|
||||
value = 0; |
|
||||
|
|
||||
txtBox.Text = _mountains[value]; |
|
||||
} |
|
||||
|
|
||||
private readonly string[] _mountains = new[] |
|
||||
{ |
|
||||
"Everest", |
|
||||
"K2 (Mount Godwin Austen)", |
|
||||
"Kangchenjunga", |
|
||||
"Lhotse", |
|
||||
"Makalu", |
|
||||
"Cho Oyu", |
|
||||
"Dhaulagiri", |
|
||||
"Manaslu", |
|
||||
"Nanga Parbat", |
|
||||
"Annapurna" |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
@ -1,47 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Calendar</TextBlock> |
|
||||
<TextBlock Classes="h2">A calendar control for selecting dates</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock Text="SelectionMode: None"/> |
|
||||
<Calendar SelectionMode="None" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="SelectionMode: SingleDate"/> |
|
||||
<Calendar SelectionMode="SingleDate" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="Disabled"/> |
|
||||
<Calendar IsEnabled="False" |
|
||||
SelectionMode="SingleDate"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock Text="SelectionMode: SingleRange"/> |
|
||||
<Calendar SelectionMode="SingleRange" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="SelectionMode: MultipleRange"/> |
|
||||
<Calendar SelectionMode="MultipleRange"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock Text="DisplayDates"/> |
|
||||
<Calendar Name="DisplayDatesCalendar" |
|
||||
SelectionMode="SingleDate" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="BlackoutDates"/> |
|
||||
<Calendar Name="BlackoutDatesCalendar" |
|
||||
SelectionMode="SingleDate" /> |
|
||||
</StackPanel> |
|
||||
|
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,28 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using System; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class CalendarPage : UserControl |
|
||||
{ |
|
||||
public CalendarPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
|
|
||||
var today = DateTime.Today; |
|
||||
var cal1 = this.FindControl<Calendar>("DisplayDatesCalendar"); |
|
||||
cal1.DisplayDateStart = today.AddDays(-25); |
|
||||
cal1.DisplayDateEnd = today.AddDays(25); |
|
||||
|
|
||||
var cal2 = this.FindControl<Calendar>("BlackoutDatesCalendar"); |
|
||||
cal2.BlackoutDates.AddDatesInPast(); |
|
||||
cal2.BlackoutDates.Add(new CalendarDateRange(today.AddDays(6))); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,35 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Canvas</TextBlock> |
|
||||
<TextBlock Classes="h2">A panel which lays out its children by explicit coordinates</TextBlock> |
|
||||
<Canvas Background="Yellow" Width="300" Height="400"> |
|
||||
<Rectangle Fill="Blue" Width="63" Height="41" Canvas.Left="40" Canvas.Top="31"> |
|
||||
<Rectangle.OpacityMask> |
|
||||
<LinearGradientBrush StartPoint="0%,0%" EndPoint="100%,100%"> |
|
||||
<LinearGradientBrush.GradientStops> |
|
||||
<GradientStop Offset="0" Color="Black"/> |
|
||||
<GradientStop Offset="1" Color="Transparent"/> |
|
||||
</LinearGradientBrush.GradientStops> |
|
||||
</LinearGradientBrush> |
|
||||
</Rectangle.OpacityMask> |
|
||||
</Rectangle> |
|
||||
<Ellipse Fill="Green" Width="58" Height="58" Canvas.Left="88" Canvas.Top="100"/> |
|
||||
<Path Fill="Orange" Data="M 0,0 c 0,0 50,0 50,-50 c 0,0 50,0 50,50 h -50 v 50 l -50,-50 Z" Canvas.Left="30" Canvas.Top="250"/> |
|
||||
<Path Fill="OrangeRed" Canvas.Left="180" Canvas.Top="250"> |
|
||||
<Path.Data> |
|
||||
<PathGeometry> |
|
||||
<PathFigure StartPoint="0,0" IsClosed="True"> |
|
||||
<QuadraticBezierSegment Point1="50,0" Point2="50,-50" /> |
|
||||
<QuadraticBezierSegment Point1="100,-50" Point2="100,0" /> |
|
||||
<LineSegment Point="50,0" /> |
|
||||
<LineSegment Point="50,50" /> |
|
||||
</PathFigure> |
|
||||
</PathGeometry> |
|
||||
</Path.Data> |
|
||||
</Path> |
|
||||
<Line StartPoint="120,185" EndPoint="30,115" Stroke="Red" StrokeThickness="2"/> |
|
||||
<Polygon Points="75,0 120,120 0,45 150,45 30,120" Stroke="DarkBlue" StrokeThickness="1" Fill="Violet" Canvas.Left="150" Canvas.Top="31"/> |
|
||||
<Polyline Points="0,0 65,0 78,-26 91,39 104,-39 117,13 130,0 195,0" Stroke="Brown" Canvas.Left="30" Canvas.Top="350"/> |
|
||||
</Canvas> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class CanvasPage : UserControl |
|
||||
{ |
|
||||
public CanvasPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,41 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Carousel</TextBlock> |
|
||||
<TextBlock Classes="h2">An items control that displays its items as pages that fill the control.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 16 0 0" Spacing="8"> |
|
||||
<Button Name="left" VerticalAlignment="Center" Padding="20"> |
|
||||
<Path Data="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z" Fill="Black"/> |
|
||||
</Button> |
|
||||
<Carousel Name="carousel"> |
|
||||
<Carousel.PageTransition> |
|
||||
<PageSlide Duration="0.25" Orientation="Vertical" /> |
|
||||
</Carousel.PageTransition> |
|
||||
<Image Source="resm:ControlCatalog.Assets.delicate-arch-896885_640.jpg"/> |
|
||||
<Image Source="resm:ControlCatalog.Assets.hirsch-899118_640.jpg"/> |
|
||||
<Image Source="resm:ControlCatalog.Assets.maple-leaf-888807_640.jpg"/> |
|
||||
</Carousel> |
|
||||
<Button Name="right" VerticalAlignment="Center" Padding="20"> |
|
||||
<Path Data="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z" Fill="Black"/> |
|
||||
</Button> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"> |
|
||||
<TextBlock VerticalAlignment="Center">Transition</TextBlock> |
|
||||
<DropDown Name="transition" SelectedIndex="1" VerticalAlignment="Center"> |
|
||||
<DropDownItem>None</DropDownItem> |
|
||||
<DropDownItem>Slide</DropDownItem> |
|
||||
<DropDownItem>Crossfade</DropDownItem> |
|
||||
</DropDown> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" Spacing="4"> |
|
||||
<TextBlock VerticalAlignment="Center">Orientation</TextBlock> |
|
||||
<DropDown Name="orientation" SelectedIndex="1" VerticalAlignment="Center"> |
|
||||
<DropDownItem>Horizontal</DropDownItem> |
|
||||
<DropDownItem>Vertical</DropDownItem> |
|
||||
</DropDown> |
|
||||
</StackPanel> |
|
||||
|
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,51 +0,0 @@ |
|||||
using System; |
|
||||
using Avalonia.Animation; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class CarouselPage : UserControl |
|
||||
{ |
|
||||
private Carousel _carousel; |
|
||||
private Button _left; |
|
||||
private Button _right; |
|
||||
private DropDown _transition; |
|
||||
private DropDown _orientation; |
|
||||
|
|
||||
public CarouselPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
_left.Click += (s, e) => _carousel.Previous(); |
|
||||
_right.Click += (s, e) => _carousel.Next(); |
|
||||
_transition.SelectionChanged += TransitionChanged; |
|
||||
_orientation.SelectionChanged += TransitionChanged; |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
_carousel = this.FindControl<Carousel>("carousel"); |
|
||||
_left = this.FindControl<Button>("left"); |
|
||||
_right = this.FindControl<Button>("right"); |
|
||||
_transition = this.FindControl<DropDown>("transition"); |
|
||||
_orientation = this.FindControl<DropDown>("orientation"); |
|
||||
} |
|
||||
|
|
||||
private void TransitionChanged(object sender, SelectionChangedEventArgs e) |
|
||||
{ |
|
||||
switch (_transition.SelectedIndex) |
|
||||
{ |
|
||||
case 0: |
|
||||
_carousel.PageTransition = null; |
|
||||
break; |
|
||||
case 1: |
|
||||
_carousel.PageTransition = new PageSlide(TimeSpan.FromSeconds(0.25), _orientation.SelectedIndex == 0 ? PageSlide.SlideAxis.Horizontal : PageSlide.SlideAxis.Vertical); |
|
||||
break; |
|
||||
case 2: |
|
||||
_carousel.PageTransition = new CrossFade(TimeSpan.FromSeconds(0.25)); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,28 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">CheckBox</TextBlock> |
|
||||
<TextBlock Classes="h2">A check box control</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="16"> |
|
||||
<CheckBox>Unchecked</CheckBox> |
|
||||
<CheckBox IsChecked="True">Checked</CheckBox> |
|
||||
<CheckBox IsChecked="{x:Null}">Indeterminate</CheckBox> |
|
||||
<CheckBox IsChecked="True" IsEnabled="False">Disabled</CheckBox> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<CheckBox IsChecked="False" IsThreeState="True">Three State: Unchecked</CheckBox> |
|
||||
<CheckBox IsChecked="True" IsThreeState="True">Three State: Checked</CheckBox> |
|
||||
<CheckBox IsChecked="{x:Null}" IsThreeState="True">Three State: Indeterminate</CheckBox> |
|
||||
<CheckBox IsChecked="{x:Null}" IsThreeState="True" IsEnabled="False">Three State: Disabled</CheckBox> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class CheckBoxPage : UserControl |
|
||||
{ |
|
||||
public CheckBoxPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,36 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Context Menu</TextBlock> |
|
||||
<TextBlock Classes="h2">A right click menu that can be applied to any control.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush}" |
|
||||
Padding="48,48,48,48"> |
|
||||
<Border.ContextMenu> |
|
||||
<ContextMenu> |
|
||||
<MenuItem Header="Standard _Menu Item"/> |
|
||||
<Separator/> |
|
||||
<MenuItem Header="Menu with _Submenu"> |
|
||||
<MenuItem Header="Submenu _1"/> |
|
||||
<MenuItem Header="Submenu _2"/> |
|
||||
</MenuItem> |
|
||||
<MenuItem Header="Menu Item with _Icon"> |
|
||||
<MenuItem.Icon> |
|
||||
<Image Source="resm:ControlCatalog.Assets.github_icon.png"/> |
|
||||
</MenuItem.Icon> |
|
||||
</MenuItem> |
|
||||
<MenuItem Header="Menu Item with _Checkbox"> |
|
||||
<MenuItem.Icon> |
|
||||
<CheckBox BorderThickness="0" IsHitTestVisible="False" IsChecked="True"/> |
|
||||
</MenuItem.Icon> |
|
||||
</MenuItem> |
|
||||
</ContextMenu> |
|
||||
</Border.ContextMenu> |
|
||||
<TextBlock Text="Right Click Here"/> |
|
||||
</Border> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ContextMenuPage : UserControl |
|
||||
{ |
|
||||
public ContextMenuPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,46 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">DatePicker</TextBlock> |
|
||||
<TextBlock Classes="h2">A control for selecting dates with a calendar drop-down</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Width="200"> |
|
||||
<TextBlock Text="SelectedDateFormat: Short"/> |
|
||||
<DatePicker Name="DatePicker1" |
|
||||
SelectedDateFormat="Short" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="SelectedDateFormat: Long"/> |
|
||||
<DatePicker Name="DatePicker2" |
|
||||
SelectedDateFormat="Long" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="SelectedDateFormat: Custom"/> |
|
||||
<DatePicker Name="DatePicker3" |
|
||||
SelectedDateFormat="Custom" |
|
||||
CustomDateFormatString="ddd, MMM d" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<TextBlock Text="Blackout Dates"/> |
|
||||
<DatePicker Name="DatePicker4" |
|
||||
Margin="0,0,0,8"/> |
|
||||
|
|
||||
<DatePicker Margin="0,0,0,8" |
|
||||
Watermark="Watermark"/> |
|
||||
<DatePicker Margin="0,0,0,8" |
|
||||
Name="DatePicker5" |
|
||||
Watermark="Floating Watermark" |
|
||||
UseFloatingWatermark="True"/> |
|
||||
|
|
||||
<TextBlock Text="Disabled"/> |
|
||||
<DatePicker IsEnabled="False"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,36 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using System; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class DatePickerPage : UserControl |
|
||||
{ |
|
||||
public DatePickerPage() |
|
||||
{ |
|
||||
InitializeComponent(); |
|
||||
|
|
||||
var dp1 = this.FindControl<DatePicker>("DatePicker1"); |
|
||||
var dp2 = this.FindControl<DatePicker>("DatePicker2"); |
|
||||
var dp3 = this.FindControl<DatePicker>("DatePicker3"); |
|
||||
var dp4 = this.FindControl<DatePicker>("DatePicker4"); |
|
||||
var dp5 = this.FindControl<DatePicker>("DatePicker5"); |
|
||||
|
|
||||
dp1.SelectedDate = DateTime.Today; |
|
||||
dp2.SelectedDate = DateTime.Today.AddDays(10); |
|
||||
dp3.SelectedDate = DateTime.Today.AddDays(20); |
|
||||
dp5.SelectedDate = DateTime.Today; |
|
||||
|
|
||||
dp4.TemplateApplied += (s, e) => |
|
||||
{ |
|
||||
dp4.BlackoutDates.AddDatesInPast(); |
|
||||
}; |
|
||||
|
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4" Margin="4"> |
|
||||
<Button Name="OpenFile">Open File</Button> |
|
||||
<Button Name="SaveFile">Save File</Button> |
|
||||
<Button Name="SelectFolder">Select Folder</Button> |
|
||||
<StackPanel Orientation="Horizontal"> |
|
||||
<CheckBox Name="IsModal" IsChecked="True"/> |
|
||||
<TextBlock>Modal to window</TextBlock> |
|
||||
</StackPanel> |
|
||||
<Button Name="DecoratedWindow">Decorated window</Button> |
|
||||
<Button Name="ChildWindow">Child window</Button> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,59 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
#pragma warning disable 4014
|
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class DialogsPage : UserControl |
|
||||
{ |
|
||||
public DialogsPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
this.FindControl<Button>("OpenFile").Click += delegate |
|
||||
{ |
|
||||
new OpenFileDialog() |
|
||||
{ |
|
||||
Title = "Open file" |
|
||||
}.ShowAsync(GetWindow()); |
|
||||
}; |
|
||||
this.FindControl<Button>("SaveFile").Click += delegate |
|
||||
{ |
|
||||
new SaveFileDialog() |
|
||||
{ |
|
||||
Title = "Save file" |
|
||||
}.ShowAsync(GetWindow()); |
|
||||
}; |
|
||||
this.FindControl<Button>("SelectFolder").Click += delegate |
|
||||
{ |
|
||||
new OpenFolderDialog() |
|
||||
{ |
|
||||
Title = "Select folder" |
|
||||
}.ShowAsync(GetWindow()); |
|
||||
}; |
|
||||
this.FindControl<Button>("DecoratedWindow").Click += delegate |
|
||||
{ |
|
||||
new DecoratedWindow().Show(); |
|
||||
}; |
|
||||
this.FindControl<Button>("ChildWindow").Click += delegate |
|
||||
{ |
|
||||
|
|
||||
var window = new Window |
|
||||
{ |
|
||||
Height = 200, |
|
||||
Width = 200, |
|
||||
Content = new Button{ Content = "Test"} |
|
||||
}; |
|
||||
|
|
||||
window.ShowDialog(); |
|
||||
|
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
Window GetWindow() => this.FindControl<CheckBox>("IsModal").IsChecked.Value ? (Window)this.VisualRoot : null; |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Drag+Drop</TextBlock> |
|
||||
<TextBlock Classes="h2">Example of Drag+Drop capabilities</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<Border BorderBrush="{DynamicResource ThemeAccentBrush}" BorderThickness="2" Padding="16" Name="DragMe"> |
|
||||
<TextBlock Name="DragState">Drag Me</TextBlock> |
|
||||
</Border> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush2}" Padding="16" |
|
||||
DragDrop.AllowDrop="True"> |
|
||||
<TextBlock Name="DropState">Drop some text or files here</TextBlock> |
|
||||
</Border> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,71 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Input; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Text; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class DragAndDropPage : UserControl |
|
||||
{ |
|
||||
private TextBlock _DropState; |
|
||||
private TextBlock _DragState; |
|
||||
private Border _DragMe; |
|
||||
private int DragCount = 0; |
|
||||
|
|
||||
public DragAndDropPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
|
|
||||
_DragMe.PointerPressed += DoDrag; |
|
||||
|
|
||||
AddHandler(DragDrop.DropEvent, Drop); |
|
||||
AddHandler(DragDrop.DragOverEvent, DragOver); |
|
||||
} |
|
||||
|
|
||||
private async void DoDrag(object sender, Avalonia.Input.PointerPressedEventArgs e) |
|
||||
{ |
|
||||
DataObject dragData = new DataObject(); |
|
||||
dragData.Set(DataFormats.Text, $"You have dragged text {++DragCount} times"); |
|
||||
|
|
||||
var result = await DragDrop.DoDragDrop(dragData, DragDropEffects.Copy); |
|
||||
switch(result) |
|
||||
{ |
|
||||
case DragDropEffects.Copy: |
|
||||
_DragState.Text = "The text was copied"; break; |
|
||||
case DragDropEffects.Link: |
|
||||
_DragState.Text = "The text was linked"; break; |
|
||||
case DragDropEffects.None: |
|
||||
_DragState.Text = "The drag operation was canceled"; break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void DragOver(object sender, DragEventArgs e) |
|
||||
{ |
|
||||
// Only allow Copy or Link as Drop Operations.
|
|
||||
e.DragEffects = e.DragEffects & (DragDropEffects.Copy | DragDropEffects.Link); |
|
||||
|
|
||||
// Only allow if the dragged data contains text or filenames.
|
|
||||
if (!e.Data.Contains(DataFormats.Text) && !e.Data.Contains(DataFormats.FileNames)) |
|
||||
e.DragEffects = DragDropEffects.None; |
|
||||
} |
|
||||
|
|
||||
private void Drop(object sender, DragEventArgs e) |
|
||||
{ |
|
||||
if (e.Data.Contains(DataFormats.Text)) |
|
||||
_DropState.Text = e.Data.GetText(); |
|
||||
else if (e.Data.Contains(DataFormats.FileNames)) |
|
||||
_DropState.Text = string.Join(Environment.NewLine, e.Data.GetFileNames()); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
|
|
||||
_DropState = this.Find<TextBlock>("DropState"); |
|
||||
_DragState = this.Find<TextBlock>("DragState"); |
|
||||
_DragMe = this.Find<Border>("DragMe"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,31 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">DropDown</TextBlock> |
|
||||
<TextBlock Classes="h2">A drop-down list.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 16 0 0" Spacing="8"> |
|
||||
<DropDown SelectedIndex="0"> |
|
||||
<DropDownItem>Inline Items</DropDownItem> |
|
||||
<DropDownItem>Inline Item 2</DropDownItem> |
|
||||
<DropDownItem>Inline Item 3</DropDownItem> |
|
||||
<DropDownItem>Inline Item 4</DropDownItem> |
|
||||
</DropDown> |
|
||||
|
|
||||
<DropDown SelectedIndex="0"> |
|
||||
<DropDownItem> |
|
||||
<Panel> |
|
||||
<Rectangle Fill="{DynamicResource ThemeAccentBrush}"/> |
|
||||
<TextBlock Margin="8">Control Items</TextBlock> |
|
||||
</Panel> |
|
||||
</DropDownItem> |
|
||||
<DropDownItem> |
|
||||
<Ellipse Width="50" Height="50" Fill="Yellow"/> |
|
||||
</DropDownItem> |
|
||||
<DropDownItem> |
|
||||
<TextBox Text="TextBox"/> |
|
||||
</DropDownItem> |
|
||||
</DropDown> |
|
||||
</StackPanel> |
|
||||
|
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class DropDownPage : UserControl |
|
||||
{ |
|
||||
public DropDownPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Expander</TextBlock> |
|
||||
<TextBlock Classes="h2">Expands to show nested content</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<Expander Header="Expand Up" ExpandDirection="Up"> |
|
||||
<StackPanel> |
|
||||
<TextBlock>Expanded content</TextBlock> |
|
||||
</StackPanel> |
|
||||
</Expander> |
|
||||
<Expander Header="Expand Down" ExpandDirection="Down"> |
|
||||
<StackPanel> |
|
||||
<TextBlock>Expanded content</TextBlock> |
|
||||
</StackPanel> |
|
||||
</Expander> |
|
||||
<Expander Header="Expand Left" ExpandDirection="Left"> |
|
||||
<StackPanel> |
|
||||
<TextBlock>Expanded content</TextBlock> |
|
||||
</StackPanel> |
|
||||
</Expander> |
|
||||
<Expander Header="Expand Right" ExpandDirection="Right"> |
|
||||
<StackPanel> |
|
||||
<TextBlock>Expanded content</TextBlock> |
|
||||
</StackPanel> |
|
||||
</Expander> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ExpanderPage : UserControl |
|
||||
{ |
|
||||
public ExpanderPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,43 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Image</TextBlock> |
|
||||
<TextBlock Classes="h2">Displays an image</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock>No Stretch</TextBlock> |
|
||||
<Image Source="resm:ControlCatalog.Assets.delicate-arch-896885_640.jpg" |
|
||||
Width="100" Height="200" |
|
||||
Stretch="None"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock>Fill</TextBlock> |
|
||||
<Image Source="resm:ControlCatalog.Assets.delicate-arch-896885_640.jpg" |
|
||||
Width="100" Height="200" |
|
||||
Stretch="Fill"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock>Uniform</TextBlock> |
|
||||
<Image Source="resm:ControlCatalog.Assets.delicate-arch-896885_640.jpg" |
|
||||
Width="100" Height="200" |
|
||||
Stretch="Uniform"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock>UniformToFill</TextBlock> |
|
||||
<Image Source="resm:ControlCatalog.Assets.delicate-arch-896885_640.jpg" |
|
||||
Width="100" Height="200" |
|
||||
Stretch="UniformToFill"/> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Vertical"> |
|
||||
<TextBlock>Window Icon as an Image</TextBlock> |
|
||||
<Image Name="Icon" Width="100" Height="200" Stretch="None" /> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,41 +0,0 @@ |
|||||
using System.IO; |
|
||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using Avalonia.Media.Imaging; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ImagePage : UserControl |
|
||||
{ |
|
||||
private Image iconImage; |
|
||||
public ImagePage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
iconImage = this.Get<Image>("Icon"); |
|
||||
} |
|
||||
|
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) |
|
||||
{ |
|
||||
base.OnAttachedToVisualTree(e); |
|
||||
if (iconImage.Source == null) |
|
||||
{ |
|
||||
var windowRoot = e.Root as Window; |
|
||||
if (windowRoot != null) |
|
||||
{ |
|
||||
using (var stream = new MemoryStream()) |
|
||||
{ |
|
||||
windowRoot.Icon.Save(stream); |
|
||||
stream.Seek(0, SeekOrigin.Begin); |
|
||||
iconImage.Source = new Bitmap(stream); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,26 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<DockPanel> |
|
||||
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto" Margin="16" DockPanel.Dock="Top"> |
|
||||
<TextBlock Grid.Column="0" Grid.Row="0">Rotation</TextBlock> |
|
||||
<Slider Name="rotation" Maximum="360" Grid.Column="1" Grid.Row="0"/> |
|
||||
</Grid> |
|
||||
|
|
||||
<Grid ColumnDefinitions="24,Auto,24" |
|
||||
RowDefinitions="24,Auto,24" |
|
||||
HorizontalAlignment="Center" |
|
||||
VerticalAlignment="Center"> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="1" Grid.Row="0"/> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="0" Grid.Row="1"/> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="2" Grid.Row="1"/> |
|
||||
<Border Background="{DynamicResource ThemeAccentBrush}" Grid.Column="1" Grid.Row="2"/> |
|
||||
|
|
||||
<LayoutTransformControl Name="layoutTransform" Grid.Column="1" Grid.Row="1"> |
|
||||
<LayoutTransformControl.LayoutTransform> |
|
||||
<RotateTransform Angle="{Binding #rotation.Value}"/> |
|
||||
</LayoutTransformControl.LayoutTransform> |
|
||||
<TextBlock>Layout Transform</TextBlock> |
|
||||
</LayoutTransformControl> |
|
||||
</Grid> |
|
||||
</DockPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class LayoutTransformControlPage : UserControl |
|
||||
{ |
|
||||
public LayoutTransformControlPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">ListBox</TextBlock> |
|
||||
<TextBlock Classes="h2">Hosts a collection of ListBoxItem.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<ListBox Items="{Binding}" Width="250" Height="350"></ListBox> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,25 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ListBoxPage : UserControl |
|
||||
{ |
|
||||
public ListBoxPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
DataContext = Enumerable.Range(1, 10).Select(i => $"Item {i}" ) |
|
||||
.ToArray(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,35 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Menu</TextBlock> |
|
||||
<TextBlock Classes="h2">A window menu</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<Menu> |
|
||||
<MenuItem Header="_First"> |
|
||||
<MenuItem Header="Standard _Menu Item"/> |
|
||||
<Separator/> |
|
||||
<MenuItem Header="Menu with _Submenu"> |
|
||||
<MenuItem Header="Submenu _1"/> |
|
||||
<MenuItem Header="Submenu _2"/> |
|
||||
</MenuItem> |
|
||||
<MenuItem Header="Menu Item with _Icon"> |
|
||||
<MenuItem.Icon> |
|
||||
<Image Source="resm:ControlCatalog.Assets.github_icon.png"/> |
|
||||
</MenuItem.Icon> |
|
||||
</MenuItem> |
|
||||
<MenuItem Header="Menu Item with _Checkbox"> |
|
||||
<MenuItem.Icon> |
|
||||
<CheckBox BorderThickness="0" IsHitTestVisible="False" IsChecked="True"/> |
|
||||
</MenuItem.Icon> |
|
||||
</MenuItem> |
|
||||
</MenuItem> |
|
||||
<MenuItem Header="_Second"> |
|
||||
<MenuItem Header="Second _Menu Item"/> |
|
||||
</MenuItem> |
|
||||
</Menu> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class MenuPage : UserControl |
|
||||
{ |
|
||||
public MenuPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,24 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">ProgressBar</TextBlock> |
|
||||
<TextBlock Classes="h2">A progress bar control</TextBlock> |
|
||||
|
|
||||
<StackPanel> |
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Spacing="16"> |
|
||||
<ProgressBar Value="{Binding #hprogress.Value}" /> |
|
||||
<ProgressBar IsIndeterminate="True"/> |
|
||||
</StackPanel> |
|
||||
<ProgressBar Value="{Binding #vprogress.Value}" Orientation="Vertical" /> |
|
||||
<ProgressBar Orientation="Vertical" IsIndeterminate="True" /> |
|
||||
</StackPanel> |
|
||||
<StackPanel Margin="16"> |
|
||||
<Slider Name="hprogress" Maximum="100" Value="40"/> |
|
||||
<Slider Name="vprogress" Maximum="100" Value="60"/> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ProgressBarPage : UserControl |
|
||||
{ |
|
||||
public ProgressBarPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,40 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">RadioButton</TextBlock> |
|
||||
<TextBlock Classes="h2">Allows the selection of a single option of many</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="16"> |
|
||||
<RadioButton IsChecked="True">Option 1</RadioButton> |
|
||||
<RadioButton>Option 2</RadioButton> |
|
||||
<RadioButton IsChecked="{x:Null}">Option 3</RadioButton> |
|
||||
<RadioButton IsEnabled="False">Disabled</RadioButton> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="16"> |
|
||||
<RadioButton IsChecked="True" IsThreeState="True">Three States: Option 1</RadioButton> |
|
||||
<RadioButton IsChecked="False" IsThreeState="True">Three States: Option 2</RadioButton> |
|
||||
<RadioButton IsChecked="{x:Null}" IsThreeState="True">Three States: Option 3</RadioButton> |
|
||||
<RadioButton IsChecked="{x:Null}" IsThreeState="True" IsEnabled="False">Disabled</RadioButton> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="16"> |
|
||||
<RadioButton GroupName="A" IsChecked="True">Group A: Option 1</RadioButton> |
|
||||
<RadioButton GroupName="A" IsEnabled="False">Group A: Disabled</RadioButton> |
|
||||
<RadioButton GroupName="B">Group B: Option 1</RadioButton> |
|
||||
<RadioButton GroupName="B" IsChecked="{x:Null}">Group B: Option 3</RadioButton> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="16"> |
|
||||
<RadioButton GroupName="A" IsChecked="True">Group A: Option 2</RadioButton> |
|
||||
<RadioButton GroupName="B">Group B: Option 2</RadioButton> |
|
||||
<RadioButton GroupName="B" IsChecked="{x:Null}">Group B: Option 4</RadioButton> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class RadioButtonPage : UserControl |
|
||||
{ |
|
||||
public RadioButtonPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,66 +0,0 @@ |
|||||
using System; |
|
||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
using Avalonia.Media; |
|
||||
using Avalonia.Platform; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ScreenPage : UserControl |
|
||||
{ |
|
||||
private double _leftMost; |
|
||||
|
|
||||
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) |
|
||||
{ |
|
||||
base.OnAttachedToVisualTree(e); |
|
||||
Window w = (Window)VisualRoot; |
|
||||
w.PositionChanged += (sender, args) => InvalidateVisual(); |
|
||||
} |
|
||||
|
|
||||
public override void Render(DrawingContext context) |
|
||||
{ |
|
||||
base.Render(context); |
|
||||
Window w = (Window)VisualRoot; |
|
||||
Screen[] screens = w.Screens.All; |
|
||||
|
|
||||
Pen p = new Pen(Brushes.Black); |
|
||||
if (screens != null) |
|
||||
foreach (Screen screen in screens) |
|
||||
{ |
|
||||
if (screen.Bounds.X / 10f < _leftMost) |
|
||||
{ |
|
||||
_leftMost = screen.Bounds.X / 10f; |
|
||||
InvalidateVisual(); |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
Rect boundsRect = new Rect(screen.Bounds.X / 10f + Math.Abs(_leftMost), screen.Bounds.Y / 10f, screen.Bounds.Width / 10f, |
|
||||
screen.Bounds.Height / 10f); |
|
||||
Rect workingAreaRect = new Rect(screen.WorkingArea.X / 10f + Math.Abs(_leftMost), screen.WorkingArea.Y / 10f, screen.WorkingArea.Width / 10f, |
|
||||
screen.WorkingArea.Height / 10f); |
|
||||
context.DrawRectangle(p, boundsRect); |
|
||||
context.DrawRectangle(p, workingAreaRect); |
|
||||
|
|
||||
FormattedText text = new FormattedText() |
|
||||
{ |
|
||||
Typeface = Typeface.Default |
|
||||
}; |
|
||||
|
|
||||
text.Text = $"Bounds: {screen.Bounds.Width}:{screen.Bounds.Height}"; |
|
||||
context.DrawText(Brushes.Black, boundsRect.Position.WithY(boundsRect.Size.Height), text); |
|
||||
|
|
||||
text.Text = $"WorkArea: {screen.WorkingArea.Width}:{screen.WorkingArea.Height}"; |
|
||||
context.DrawText(Brushes.Black, boundsRect.Position.WithY(boundsRect.Size.Height + 20), text); |
|
||||
|
|
||||
text.Text = $"Primary: {screen.Primary}"; |
|
||||
context.DrawText(Brushes.Black, boundsRect.Position.WithY(boundsRect.Size.Height + 40), text); |
|
||||
|
|
||||
text.Text = $"Current: {screen.Equals(w.Screens.ScreenFromBounds(new Rect(w.Position, w.Bounds.Size)))}"; |
|
||||
context.DrawText(Brushes.Black, boundsRect.Position.WithY(boundsRect.Size.Height + 60), text); |
|
||||
} |
|
||||
|
|
||||
context.DrawRectangle(p, new Rect(w.Position.X / 10f + Math.Abs(_leftMost), w.Position.Y / 10, w.Bounds.Width / 10, w.Bounds.Height / 10)); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,21 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">Slider</TextBlock> |
|
||||
<TextBlock Classes="h2">A control that lets the user select from a range of values by moving a Thumb control along a Track.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 16 0 0" Spacing="16"> |
|
||||
<Slider Value="0" |
|
||||
Minimum="0" |
|
||||
Maximum="100" |
|
||||
Width="300"/> |
|
||||
<Slider Value="0" |
|
||||
Minimum="0" |
|
||||
Maximum="100" |
|
||||
Orientation="Vertical" |
|
||||
IsSnapToTickEnabled="True" |
|
||||
TickFrequency="10" |
|
||||
Height="300"/> |
|
||||
</StackPanel> |
|
||||
|
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class SliderPage : UserControl |
|
||||
{ |
|
||||
public SliderPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,43 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">TextBox</TextBlock> |
|
||||
<TextBlock Classes="h2">A control into which the user can input text</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="8"> |
|
||||
<TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200" /> |
|
||||
<TextBox Watermark="ReadOnly" IsReadOnly="True" Text="This is read only"/> |
|
||||
<TextBox Width="200" Watermark="Watermark" /> |
|
||||
<TextBox Width="200" |
|
||||
Watermark="Floating Watermark" |
|
||||
UseFloatingWatermark="True" |
|
||||
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/> |
|
||||
|
|
||||
<TextBox Width="200" |
|
||||
Watermark="Password Box" |
|
||||
UseFloatingWatermark="True" |
|
||||
PasswordChar="*" |
|
||||
Text="Password" /> |
|
||||
<TextBox Width="200" Text="Left aligned text" TextAlignment="Left" /> |
|
||||
<TextBox Width="200" Text="Center aligned text" TextAlignment="Center" /> |
|
||||
<TextBox Width="200" Text="Right aligned text" TextAlignment="Right" /> |
|
||||
</StackPanel> |
|
||||
|
|
||||
<StackPanel Orientation="Vertical" Spacing="8"> |
|
||||
<TextBox AcceptsReturn="True" TextWrapping="Wrap" Width="200" Height="125" |
|
||||
Text="Multiline TextBox with TextWrapping.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." /> |
|
||||
<TextBox AcceptsReturn="True" Width="200" Height="125" |
|
||||
Text="Multiline TextBox with no TextWrapping.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." /> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Vertical" Spacing="8"> |
|
||||
<TextBox Width="200" Text="Custom font regular" FontWeight="Normal" FontStyle="Normal" FontFamily="resm:ControlCatalog.Assets.Fonts?assembly=ControlCatalog#Source Sans Pro"/> |
|
||||
<TextBox Width="200" Text="Custom font bold" FontWeight="Bold" FontStyle="Normal" FontFamily="resm:ControlCatalog.Assets.Fonts?assembly=ControlCatalog#Source Sans Pro"/> |
|
||||
<TextBox Width="200" Text="Custom font italic" FontWeight="Normal" FontStyle="Italic" FontFamily="resm:ControlCatalog.Assets.Fonts.SourceSansPro-Italic.ttf?assembly=ControlCatalog#Source Sans Pro"/> |
|
||||
<TextBox Width="200" Text="Custom font italic bold" FontWeight="Bold" FontStyle="Italic" FontFamily="resm:ControlCatalog.Assets.Fonts.SourceSansPro-*.ttf?assembly=ControlCatalog#Source Sans Pro"/> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class TextBoxPage : UserControl |
|
||||
{ |
|
||||
public TextBoxPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,41 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" |
|
||||
Spacing="4"> |
|
||||
<TextBlock Classes="h1">ToolTip</TextBlock> |
|
||||
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
|
||||
|
|
||||
<Grid RowDefinitions="Auto,Auto" |
|
||||
ColumnDefinitions="Auto,Auto" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center"> |
|
||||
<Border Grid.Column="0" |
|
||||
Grid.Row="1" |
|
||||
Background="{DynamicResource ThemeAccentBrush}" |
|
||||
Margin="5" |
|
||||
Padding="50" |
|
||||
ToolTip.Tip="This is a ToolTip"> |
|
||||
<TextBlock>Hover Here</TextBlock> |
|
||||
</Border> |
|
||||
<CheckBox Grid.Column="1" |
|
||||
Margin="5" |
|
||||
Grid.Row="0" |
|
||||
IsChecked="{Binding ElementName=Border, Path=(ToolTip.IsOpen)}" |
|
||||
Content="ToolTip Open" /> |
|
||||
<Border Name="Border" |
|
||||
Grid.Column="1" |
|
||||
Grid.Row="1" |
|
||||
Background="{DynamicResource ThemeAccentBrush}" |
|
||||
Margin="5" |
|
||||
Padding="50" |
|
||||
ToolTip.Placement="Bottom"> |
|
||||
<ToolTip.Tip> |
|
||||
<StackPanel> |
|
||||
<TextBlock Classes="h1">ToolTip</TextBlock> |
|
||||
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock> |
|
||||
</StackPanel> |
|
||||
</ToolTip.Tip> |
|
||||
<TextBlock>ToolTip bottom placement</TextBlock> |
|
||||
</Border> |
|
||||
</Grid> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class ToolTipPage : UserControl |
|
||||
{ |
|
||||
public ToolTipPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui"> |
|
||||
<StackPanel Orientation="Vertical" Spacing="4"> |
|
||||
<TextBlock Classes="h1">TreeView</TextBlock> |
|
||||
<TextBlock Classes="h2">Displays a hierachical tree of data.</TextBlock> |
|
||||
|
|
||||
<StackPanel Orientation="Horizontal" |
|
||||
Margin="0,16,0,0" |
|
||||
HorizontalAlignment="Center" |
|
||||
Spacing="16"> |
|
||||
<TreeView Items="{Binding}" Width="250" Height="350"> |
|
||||
<TreeView.ItemTemplate> |
|
||||
<TreeDataTemplate ItemsSource="{Binding Children}"> |
|
||||
<TextBlock Text="{Binding Header}"/> |
|
||||
</TreeDataTemplate> |
|
||||
</TreeView.ItemTemplate> |
|
||||
</TreeView> |
|
||||
</StackPanel> |
|
||||
</StackPanel> |
|
||||
</UserControl> |
|
||||
@ -1,40 +0,0 @@ |
|||||
using System.Collections; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Markup.Xaml; |
|
||||
|
|
||||
namespace ControlCatalog.Pages |
|
||||
{ |
|
||||
public class TreeViewPage : UserControl |
|
||||
{ |
|
||||
public TreeViewPage() |
|
||||
{ |
|
||||
this.InitializeComponent(); |
|
||||
DataContext = new Node().Children; |
|
||||
} |
|
||||
|
|
||||
private void InitializeComponent() |
|
||||
{ |
|
||||
AvaloniaXamlLoader.Load(this); |
|
||||
} |
|
||||
|
|
||||
public class Node |
|
||||
{ |
|
||||
private IList<Node> _children; |
|
||||
public string Header { get; private set; } |
|
||||
public IList<Node> Children |
|
||||
{ |
|
||||
get |
|
||||
{ |
|
||||
if (_children == null) |
|
||||
{ |
|
||||
_children = Enumerable.Range(1, 10).Select(i => new Node() {Header = $"Item {i}"}) |
|
||||
.ToArray(); |
|
||||
} |
|
||||
return _children; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,69 +0,0 @@ |
|||||
using System; |
|
||||
using System.Diagnostics; |
|
||||
using System.IO; |
|
||||
using System.Linq; |
|
||||
using System.Threading; |
|
||||
using Avalonia; |
|
||||
using Avalonia.Skia; |
|
||||
using Avalonia.Threading; |
|
||||
|
|
||||
namespace ControlCatalog.NetCore |
|
||||
{ |
|
||||
static class Program |
|
||||
{ |
|
||||
|
|
||||
static void Main(string[] args) |
|
||||
{ |
|
||||
if (args.Contains("--wait-for-attach")) |
|
||||
{ |
|
||||
Console.WriteLine("Attach debugger and use 'Set next statement'"); |
|
||||
while (true) |
|
||||
{ |
|
||||
Thread.Sleep(100); |
|
||||
if (Debugger.IsAttached) |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
BuildAvaloniaApp().Start<MainWindow>(); |
|
||||
return; |
|
||||
var app = BuildAvaloniaApp().SetupWithoutStarting().Instance; |
|
||||
var src = new CancellationTokenSource(); |
|
||||
int cnt = 0; |
|
||||
DispatcherTimer timer = null; |
|
||||
timer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, delegate |
|
||||
{ |
|
||||
cnt++; |
|
||||
Console.WriteLine("Tick " + cnt); |
|
||||
if (cnt == 3) |
|
||||
{ |
|
||||
timer.Stop(); |
|
||||
Dispatcher.UIThread.InvokeAsync(() => |
|
||||
{ |
|
||||
Console.WriteLine("Invoked"); |
|
||||
src.Cancel(); |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
timer.Start(); |
|
||||
|
|
||||
app.Run(src.Token); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// This method is needed for IDE previewer infrastructure
|
|
||||
/// </summary>
|
|
||||
public static AppBuilder BuildAvaloniaApp() |
|
||||
{ |
|
||||
var libraryPath = Path.Combine(Directory.GetCurrentDirectory(), |
|
||||
"../../src/Avalonia.Native.OSX/build/Avalonia.Native.OSX/Build/Products/Debug/libAvalonia.Native.OSX.dylib"); |
|
||||
|
|
||||
return AppBuilder.Configure<App>().UseAvaloniaNative(libraryPath, opts => |
|
||||
{ |
|
||||
opts.UseGpu = true; |
|
||||
opts.UseDeferredRendering = true; |
|
||||
}).UseSkia(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,52 +0,0 @@ |
|||||
<Styles xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > |
|
||||
<Style Selector="TabControl.sidebar"> |
|
||||
<Setter Property="Template"> |
|
||||
<ControlTemplate> |
|
||||
<DockPanel> |
|
||||
<ScrollViewer MinWidth="190" Background="{DynamicResource ThemeAccentBrush}" DockPanel.Dock="Left"> |
|
||||
<TabStrip Name="PART_TabStrip" |
|
||||
MemberSelector="{x:Static TabControl.HeaderSelector}" |
|
||||
Items="{TemplateBinding Items}" |
|
||||
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}"> |
|
||||
<TabStrip.ItemsPanel> |
|
||||
<ItemsPanelTemplate> |
|
||||
<StackPanel Orientation="Vertical"/> |
|
||||
</ItemsPanelTemplate> |
|
||||
</TabStrip.ItemsPanel> |
|
||||
</TabStrip> |
|
||||
</ScrollViewer> |
|
||||
<Carousel Name="PART_Content" |
|
||||
Margin="8 0 0 0" |
|
||||
MemberSelector="{x:Static TabControl.ContentSelector}" |
|
||||
Items="{TemplateBinding Items}" |
|
||||
SelectedIndex="{TemplateBinding SelectedIndex}" |
|
||||
PageTransition="{TemplateBinding PageTransition}" |
|
||||
Grid.Row="1"/> |
|
||||
</DockPanel> |
|
||||
</ControlTemplate> |
|
||||
</Setter> |
|
||||
</Style> |
|
||||
|
|
||||
<Style Selector="TabControl.sidebar TabStripItem"> |
|
||||
<Setter Property="Foreground" Value="White"/> |
|
||||
<Setter Property="FontSize" Value="14"/> |
|
||||
<Setter Property="Margin" Value="0"/> |
|
||||
<Setter Property="Padding" Value="16"/> |
|
||||
<Setter Property="Opacity" Value="0.5"/> |
|
||||
<Setter Property="Transitions"> |
|
||||
<Transitions> |
|
||||
<DoubleTransition Property="Opacity" Duration="0:0:0.2"/> |
|
||||
</Transitions> |
|
||||
</Setter> |
|
||||
</Style> |
|
||||
|
|
||||
<Style Selector="TabControl.sidebar TabStripItem:pointerover"> |
|
||||
<Setter Property="Opacity" Value="1"/> |
|
||||
</Style> |
|
||||
|
|
||||
<Style Selector="TabControl.sidebar TabStripItem:selected"> |
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeAccentBrush2}"/> |
|
||||
<Setter Property="Opacity" Value="1"/> |
|
||||
</Style> |
|
||||
</Styles> |
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue