committed by
GitHub
690 changed files with 38756 additions and 6598 deletions
@ -0,0 +1,5 @@ |
|||
<ProjectConfiguration> |
|||
<Settings> |
|||
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely> |
|||
</Settings> |
|||
</ProjectConfiguration> |
|||
@ -1,5 +1,5 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="Moq" Version="4.7.99" /> |
|||
<PackageReference Include="Moq" Version="4.14.1" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -1,7 +0,0 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<PackageReference Include="Serilog" Version="2.5.0" /> |
|||
<PackageReference Include="Serilog.Sinks.Trace" Version="2.1.0" /> |
|||
<PackageReference Include="Serilog.Sinks.Debug" Version="1.0.0" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,160 @@ |
|||
#include "common.h" |
|||
|
|||
|
|||
IAvnNativeControlHostTopLevelAttachment* CreateAttachment(); |
|||
|
|||
class AvnNativeControlHost : |
|||
public ComSingleObject<IAvnNativeControlHost, &IID_IAvnNativeControlHost> |
|||
{ |
|||
public: |
|||
FORWARD_IUNKNOWN(); |
|||
NSView* View; |
|||
AvnNativeControlHost(NSView* view) |
|||
{ |
|||
View = view; |
|||
} |
|||
|
|||
virtual HRESULT CreateDefaultChild(void* parent, void** retOut) override |
|||
{ |
|||
NSView* view = [NSView new]; |
|||
[view setWantsLayer: true]; |
|||
|
|||
*retOut = (__bridge_retained void*)view; |
|||
return S_OK; |
|||
}; |
|||
|
|||
virtual IAvnNativeControlHostTopLevelAttachment* CreateAttachment() override |
|||
{ |
|||
return ::CreateAttachment(); |
|||
}; |
|||
|
|||
virtual void DestroyDefaultChild(void* child) override |
|||
{ |
|||
// ARC will release the object for us |
|||
(__bridge_transfer NSView*) child; |
|||
} |
|||
}; |
|||
|
|||
class AvnNativeControlHostTopLevelAttachment : |
|||
public ComSingleObject<IAvnNativeControlHostTopLevelAttachment, &IID_IAvnNativeControlHostTopLevelAttachment> |
|||
{ |
|||
NSView* _holder; |
|||
NSView* _child; |
|||
public: |
|||
FORWARD_IUNKNOWN(); |
|||
|
|||
AvnNativeControlHostTopLevelAttachment() |
|||
{ |
|||
_holder = [NSView new]; |
|||
[_holder setWantsLayer:true]; |
|||
} |
|||
|
|||
virtual ~AvnNativeControlHostTopLevelAttachment() |
|||
{ |
|||
if(_child != nil && [_child superview] == _holder) |
|||
{ |
|||
[_child removeFromSuperview]; |
|||
} |
|||
|
|||
if([_holder superview] != nil) |
|||
{ |
|||
[_holder removeFromSuperview]; |
|||
} |
|||
} |
|||
|
|||
virtual void* GetParentHandle() override |
|||
{ |
|||
return (__bridge void*)_holder; |
|||
}; |
|||
|
|||
virtual HRESULT InitializeWithChildHandle(void* child) override |
|||
{ |
|||
if(_child != nil) |
|||
return E_FAIL; |
|||
_child = (__bridge NSView*)child; |
|||
if(_child == nil) |
|||
return E_FAIL; |
|||
[_holder addSubview:_child]; |
|||
[_child setHidden: false]; |
|||
return S_OK; |
|||
}; |
|||
|
|||
virtual HRESULT AttachTo(IAvnNativeControlHost* host) override |
|||
{ |
|||
if(host == nil) |
|||
{ |
|||
[_holder removeFromSuperview]; |
|||
[_holder setHidden: true]; |
|||
} |
|||
else |
|||
{ |
|||
AvnNativeControlHost* chost = dynamic_cast<AvnNativeControlHost*>(host); |
|||
if(chost == nil || chost->View == nil) |
|||
return E_FAIL; |
|||
[_holder setHidden:true]; |
|||
[chost->View addSubview:_holder]; |
|||
} |
|||
return S_OK; |
|||
}; |
|||
|
|||
virtual void ShowInBounds(float x, float y, float width, float height) override |
|||
{ |
|||
if(_child == nil) |
|||
return; |
|||
if(AvnInsidePotentialDeadlock::IsInside()) |
|||
{ |
|||
IAvnNativeControlHostTopLevelAttachment* slf = this; |
|||
slf->AddRef(); |
|||
dispatch_async(dispatch_get_main_queue(), ^{ |
|||
slf->ShowInBounds(x, y, width, height); |
|||
slf->Release(); |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
NSRect childFrame = {0, 0, width, height}; |
|||
NSRect holderFrame = {x, y, width, height}; |
|||
|
|||
[_child setFrame: childFrame]; |
|||
[_holder setFrame: holderFrame]; |
|||
[_holder setHidden: false]; |
|||
if([_holder superview] != nil) |
|||
[[_holder superview] setNeedsDisplay:true]; |
|||
} |
|||
|
|||
virtual void HideWithSize(float width, float height) override |
|||
{ |
|||
if(_child == nil) |
|||
return; |
|||
if(AvnInsidePotentialDeadlock::IsInside()) |
|||
{ |
|||
IAvnNativeControlHostTopLevelAttachment* slf = this; |
|||
slf->AddRef(); |
|||
dispatch_async(dispatch_get_main_queue(), ^{ |
|||
slf->HideWithSize(width, height); |
|||
slf->Release(); |
|||
}); |
|||
return; |
|||
} |
|||
|
|||
NSRect frame = {0, 0, width, height}; |
|||
[_holder setHidden: true]; |
|||
[_child setFrame: frame]; |
|||
} |
|||
|
|||
virtual void ReleaseChild() override |
|||
{ |
|||
[_child removeFromSuperview]; |
|||
_child = nil; |
|||
} |
|||
}; |
|||
|
|||
IAvnNativeControlHostTopLevelAttachment* CreateAttachment() |
|||
{ |
|||
return new AvnNativeControlHostTopLevelAttachment(); |
|||
} |
|||
|
|||
extern IAvnNativeControlHost* CreateNativeControlHost(NSView* parent) |
|||
{ |
|||
return new AvnNativeControlHost(parent); |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
#include "common.h" |
|||
|
|||
static int Counter = 0; |
|||
AvnInsidePotentialDeadlock::AvnInsidePotentialDeadlock() |
|||
{ |
|||
Counter++; |
|||
} |
|||
|
|||
AvnInsidePotentialDeadlock::~AvnInsidePotentialDeadlock() |
|||
{ |
|||
Counter--; |
|||
} |
|||
|
|||
bool AvnInsidePotentialDeadlock::IsInside() |
|||
{ |
|||
return Counter!=0; |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
using System; |
|||
using System.IO; |
|||
using System.IO.Compression; |
|||
using System.Linq; |
|||
using ILRepacking; |
|||
using Mono.Cecil; |
|||
|
|||
public class BuildTasksPatcher |
|||
{ |
|||
public static void PatchBuildTasksInPackage(string packagePath) |
|||
{ |
|||
using (var archive = new ZipArchive(File.Open(packagePath, FileMode.Open, FileAccess.ReadWrite), |
|||
ZipArchiveMode.Update)) |
|||
{ |
|||
|
|||
foreach (var entry in archive.Entries.ToList()) |
|||
{ |
|||
if (entry.Name == "Avalonia.Build.Tasks.dll") |
|||
{ |
|||
var temp = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".dll"); |
|||
var output = temp + ".output"; |
|||
var patched = new MemoryStream(); |
|||
try |
|||
{ |
|||
entry.ExtractToFile(temp, true); |
|||
var repack = new ILRepacking.ILRepack(new RepackOptions() |
|||
{ |
|||
Internalize = true, |
|||
InputAssemblies = new[] |
|||
{ |
|||
temp, typeof(Mono.Cecil.AssemblyDefinition).Assembly.GetModules()[0] |
|||
.FullyQualifiedName |
|||
}, |
|||
SearchDirectories = new string[0], |
|||
OutputFile = output |
|||
}); |
|||
repack.Repack(); |
|||
|
|||
|
|||
// 'hurr-durr assembly with the same name is already loaded' prevention
|
|||
using (var asm = AssemblyDefinition.ReadAssembly(output, |
|||
new ReaderParameters { ReadWrite = true, InMemory = true, })) |
|||
{ |
|||
asm.Name = new AssemblyNameDefinition( |
|||
"Avalonia.Build.Tasks." |
|||
+ Guid.NewGuid().ToString().Replace("-", ""), |
|||
new Version(0, 0, 0)); |
|||
asm.Write(patched); |
|||
patched.Position = 0; |
|||
} |
|||
} |
|||
finally |
|||
{ |
|||
try |
|||
{ |
|||
if (File.Exists(temp)) |
|||
File.Delete(temp); |
|||
if (File.Exists(output)) |
|||
File.Delete(output); |
|||
} |
|||
catch |
|||
{ |
|||
//ignore
|
|||
} |
|||
} |
|||
|
|||
var fn = entry.FullName; |
|||
entry.Delete(); |
|||
var newEntry = archive.CreateEntry(fn, CompressionLevel.Optimal); |
|||
using (var s = newEntry.Open()) |
|||
patched.CopyTo(s); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1 +1 @@ |
|||
Subproject commit 4464343aef5c8ab7a42fcb20a483a6058199f8b8 |
|||
Subproject commit aef10ae67dc55c95f49b52a505a0be33bfa297a5 |
|||
@ -1,3 +1,11 @@ |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
|
|||
<ItemGroup> |
|||
<AvailableItemName Include="AvaloniaXaml" /> |
|||
<AvailableItemName Include="AvaloniaResource" /> |
|||
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)AvaloniaItemSchema.xaml" /> |
|||
</ItemGroup> |
|||
<ItemGroup Condition="'$(EnableDefaultItems)'=='True'"> |
|||
<AvaloniaXaml Include="**\*.axaml" SubType="Designer" /> |
|||
<AvaloniaXaml Include="**\*.paml" SubType="Designer" /> |
|||
</ItemGroup> |
|||
</Project> |
|||
|
|||
@ -0,0 +1,18 @@ |
|||
<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties"> |
|||
<ContentType |
|||
Name="AvaloniaXaml" |
|||
DisplayName="Avalonia XAML" |
|||
ItemType="AvaloniaXaml"> |
|||
<NameValuePair Name="DependentFileExtensions" Value=".cs" /> |
|||
<NameValuePair Name="DefaultMetadata_SubType" Value="Designer" /> |
|||
</ContentType> |
|||
|
|||
<ItemType Name="AvaloniaXaml" DisplayName="Avalonia XAML" /> |
|||
<FileExtension Name=".axaml" ContentType="AvaloniaXaml" /> |
|||
<FileExtension Name=".paml" ContentType="AvaloniaXaml" /> |
|||
<ContentType |
|||
Name="AvaloniaResource" |
|||
DisplayName="Avalonia Resource" |
|||
ItemType="AvaloniaResource" |
|||
/> |
|||
</ProjectSchemaDefinitions> |
|||
@ -0,0 +1,139 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|||
x:Class="ControlCatalog.Pages.AcrylicPage"> |
|||
<Border Padding="20" HorizontalAlignment="Center"> |
|||
<StackPanel Spacing="20"> |
|||
|
|||
<ExperimentalAcrylicBorder Width="660" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="White" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
<StackPanel Spacing="5" Margin="40 10"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="TintOpacity" Foreground="Black" /> |
|||
<Slider Name="TintOpacitySlider" Minimum="0" Maximum="1" Value="0.9" Width="400" /> |
|||
<TextBlock Text="{Binding #TintOpacitySlider.Value}" Foreground="Black" /> |
|||
</StackPanel> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<TextBlock Text="MaterialOpacity" Foreground="Black" /> |
|||
<Slider Name="MaterialOpacitySlider" Minimum="0" Maximum="1" Value="0.8" Width="400" /> |
|||
<TextBlock Text="{Binding #MaterialOpacitySlider.Value}" Foreground="Black" /> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
|
|||
<StackPanel Orientation="Horizontal" Spacing="20"> |
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#FF0000" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#00FF00" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#000000" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
</StackPanel> |
|||
|
|||
|
|||
<StackPanel Orientation="Horizontal" Spacing="20"> |
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#0000FF" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#FFFF00" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#000000" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
</StackPanel> |
|||
|
|||
<StackPanel Orientation="Horizontal" Spacing="20"> |
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="White" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="#3c3c3c" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="200" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="White" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
</StackPanel> |
|||
|
|||
<ExperimentalAcrylicBorder Height="200" Width="660" CornerRadius="5"> |
|||
<ExperimentalAcrylicBorder.Material> |
|||
<ExperimentalAcrylicMaterial |
|||
TintColor="Red" |
|||
TintOpacity="{Binding #TintOpacitySlider.Value}" |
|||
MaterialOpacity="{Binding #MaterialOpacitySlider.Value}" |
|||
BackgroundSource="Digger" /> |
|||
</ExperimentalAcrylicBorder.Material> |
|||
</ExperimentalAcrylicBorder> |
|||
</StackPanel> |
|||
</Border> |
|||
</UserControl> |
|||
@ -0,0 +1,19 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class AcrylicPage : UserControl |
|||
{ |
|||
public AcrylicPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|||
x:Class="ControlCatalog.Pages.DateTimePickerPage"> |
|||
<StackPanel Orientation="Vertical" Spacing="4" HorizontalAlignment="Stretch"> |
|||
<TextBlock Classes="h1">DatePicker and TimePicker</TextBlock> |
|||
<TextBlock Name="DatePickerDesc" Classes="h2" TextWrapping="Wrap"/> |
|||
<TextBlock Name="TimePickerDesc" Classes="h2" TextWrapping="Wrap"/> |
|||
|
|||
<StackPanel Orientation="Vertical" |
|||
Margin="16" |
|||
HorizontalAlignment="Stretch" |
|||
Spacing="16"> |
|||
<TextBlock FontSize="18">A simple DatePicker with a header</TextBlock> |
|||
<StackPanel Orientation="Vertical"> |
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1" Padding="15"> |
|||
<DatePicker Header="Pick a date" /> |
|||
</Border> |
|||
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"> |
|||
<TextBlock Padding="15"> |
|||
<TextBlock.Text> |
|||
<x:String> |
|||
<DatePicker Header="Pick a date" /> |
|||
</x:String> |
|||
</TextBlock.Text> |
|||
</TextBlock> |
|||
</Panel> |
|||
</StackPanel> |
|||
|
|||
<TextBlock FontSize="18">A DatePicker with day formatted and year hidden.</TextBlock> |
|||
<StackPanel Orientation="Vertical"> |
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1" Padding="15"> |
|||
<DatePicker x:Name="Control2" DayFormat="d (ddd)" |
|||
YearVisible="False" /> |
|||
</Border> |
|||
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"> |
|||
<TextBlock Padding="15"> |
|||
<TextBlock.Text> |
|||
<x:String> |
|||
<DatePicker DayFormat="d (ddd)" YearVisible="False" /> |
|||
</x:String> |
|||
</TextBlock.Text> |
|||
</TextBlock> |
|||
</Panel> |
|||
</StackPanel> |
|||
|
|||
<Border Background="{DynamicResource SystemControlHighlightBaseLowBrush}" BorderThickness="1" Margin="15" /> |
|||
|
|||
<TextBlock FontSize="18">A simple TimePicker.</TextBlock> |
|||
<StackPanel Orientation="Vertical"> |
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1" Padding="15"> |
|||
<TimePicker /> |
|||
</Border> |
|||
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"> |
|||
<TextBlock Padding="15"> |
|||
<TextBlock.Text> |
|||
<x:String> |
|||
<TimePicker /> |
|||
</x:String> |
|||
</TextBlock.Text> |
|||
</TextBlock> |
|||
</Panel> |
|||
</StackPanel> |
|||
|
|||
<TextBlock FontSize="18">A TimePicker with a header and minute increments specified.</TextBlock> |
|||
<StackPanel Orientation="Vertical"> |
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1" Padding="15"> |
|||
<TimePicker Header="Arrival time" MinuteIncrement="15" /> |
|||
</Border> |
|||
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"> |
|||
<TextBlock Padding="15"> |
|||
<TextBlock.Text> |
|||
<x:String> |
|||
<TimePicker Header="Arrival time" MinuteIncrement="15" /> |
|||
</x:String> |
|||
</TextBlock.Text> |
|||
</TextBlock> |
|||
</Panel> |
|||
</StackPanel> |
|||
|
|||
<TextBlock FontSize="18">A TimePicker using a 12-hour clock.</TextBlock> |
|||
<StackPanel Orientation="Vertical"> |
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1" Padding="15"> |
|||
<TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" /> |
|||
</Border> |
|||
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"> |
|||
<TextBlock Padding="15"> |
|||
<TextBlock.Text> |
|||
<x:String> |
|||
<TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" /> |
|||
</x:String> |
|||
</TextBlock.Text> |
|||
</TextBlock> |
|||
</Panel> |
|||
</StackPanel> |
|||
|
|||
<TextBlock FontSize="18">A TimePicker using a 24-hour clock.</TextBlock> |
|||
<StackPanel Orientation="Vertical"> |
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1" Padding="15"> |
|||
<TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" /> |
|||
</Border> |
|||
<Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"> |
|||
<TextBlock Padding="15"> |
|||
<TextBlock.Text> |
|||
<x:String> |
|||
<TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" /> |
|||
</x:String> |
|||
</TextBlock.Text> |
|||
</TextBlock> |
|||
</Panel> |
|||
</StackPanel> |
|||
|
|||
</StackPanel> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,30 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class DateTimePickerPage : UserControl |
|||
{ |
|||
public DateTimePickerPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
this.FindControl<TextBlock>("DatePickerDesc").Text = "Use a DatePicker to let users set a date in your app, " + |
|||
"for example to schedule an appointment. The DatePicker displays three controls for month, day, and year. " + |
|||
"These controls are easy to use with touch or mouse, and they can be styled and configured in several different ways. " + |
|||
"Order of month, day, and year is dynamically set based on user date settings"; |
|||
|
|||
this.FindControl<TextBlock>("TimePickerDesc").Text = "Use a TimePicker to let users set a time in your app, for example " + |
|||
"to set a reminder. The TimePicker displays three controls for hour, minute, and AM / PM(if necessary).These controls " + |
|||
"are easy to use with touch or mouse, and they can be styled and configured in several different ways. " + |
|||
"12 - hour or 24 - hour clock and visiblility of AM / PM is dynamically set based on user time settings, or can be overridden."; |
|||
|
|||
|
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="ControlCatalog.Pages.ScrollViewerPage"> |
|||
<StackPanel Orientation="Vertical" Spacing="4"> |
|||
<TextBlock Classes="h1">ScrollViewer</TextBlock> |
|||
<TextBlock Classes="h2">Allows for horizontal and vertical content scrolling.</TextBlock> |
|||
|
|||
<Grid ColumnDefinitions="Auto, *"> |
|||
<StackPanel Orientation="Vertical" Spacing="4"> |
|||
<ToggleSwitch IsChecked="{Binding AllowAutoHide}" Content="Allow auto hide" /> |
|||
|
|||
<StackPanel Orientation="Vertical" Spacing="4"> |
|||
<TextBlock Text="Horizontal Scroll" /> |
|||
<ComboBox Items="{Binding AvailableVisibility}" SelectedItem="{Binding HorizontalScrollVisibility}" /> |
|||
</StackPanel> |
|||
|
|||
<StackPanel Orientation="Vertical" Spacing="4"> |
|||
<TextBlock Text="Vertical Scroll" /> |
|||
<ComboBox Items="{Binding AvailableVisibility}" SelectedItem="{Binding VerticalScrollVisibility}" /> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
|
|||
<ScrollViewer x:Name="ScrollViewer" |
|||
Grid.Column="1" |
|||
Width="400" Height="400" |
|||
AllowAutoHide="{Binding AllowAutoHide}" |
|||
HorizontalScrollBarVisibility="{Binding HorizontalScrollVisibility}" |
|||
VerticalScrollBarVisibility="{Binding VerticalScrollVisibility}"> |
|||
<Image Width="800" Height="800" Stretch="UniformToFill" |
|||
Source="/Assets/delicate-arch-896885_640.jpg" /> |
|||
</ScrollViewer> |
|||
</Grid> |
|||
|
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,65 @@ |
|||
using System.Collections.Generic; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Controls.Primitives; |
|||
using Avalonia.Markup.Xaml; |
|||
using ReactiveUI; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class ScrollViewerPageViewModel : ReactiveObject |
|||
{ |
|||
private bool _allowAutoHide; |
|||
private ScrollBarVisibility _horizontalScrollVisibility; |
|||
private ScrollBarVisibility _verticalScrollVisibility; |
|||
|
|||
public ScrollViewerPageViewModel() |
|||
{ |
|||
AvailableVisibility = new List<ScrollBarVisibility> |
|||
{ |
|||
ScrollBarVisibility.Auto, |
|||
ScrollBarVisibility.Visible, |
|||
ScrollBarVisibility.Hidden, |
|||
ScrollBarVisibility.Disabled, |
|||
}; |
|||
|
|||
HorizontalScrollVisibility = ScrollBarVisibility.Auto; |
|||
VerticalScrollVisibility = ScrollBarVisibility.Auto; |
|||
AllowAutoHide = true; |
|||
} |
|||
|
|||
public bool AllowAutoHide |
|||
{ |
|||
get => _allowAutoHide; |
|||
set => this.RaiseAndSetIfChanged(ref _allowAutoHide, value); |
|||
} |
|||
|
|||
public ScrollBarVisibility HorizontalScrollVisibility |
|||
{ |
|||
get => _horizontalScrollVisibility; |
|||
set => this.RaiseAndSetIfChanged(ref _horizontalScrollVisibility, value); |
|||
} |
|||
|
|||
public ScrollBarVisibility VerticalScrollVisibility |
|||
{ |
|||
get => _verticalScrollVisibility; |
|||
set => this.RaiseAndSetIfChanged(ref _verticalScrollVisibility, value); |
|||
} |
|||
|
|||
public List<ScrollBarVisibility> AvailableVisibility { get; } |
|||
} |
|||
|
|||
public class ScrollViewerPage : UserControl |
|||
{ |
|||
public ScrollViewerPage() |
|||
{ |
|||
InitializeComponent(); |
|||
|
|||
DataContext = new ScrollViewerPageViewModel(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|||
x:Class="ControlCatalog.Pages.SplitViewPage"> |
|||
|
|||
<Border> |
|||
|
|||
<Grid ColumnDefinitions="*,225"> |
|||
|
|||
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="4" Margin="5"> |
|||
<ToggleButton Name="PaneOpenButton" |
|||
Content="IsPaneOpen" |
|||
IsChecked="{Binding IsPaneOpen, ElementName=SplitView}" /> |
|||
|
|||
<ToggleButton Name="UseLightDismissOverlayModeButton" |
|||
Content="UseLightDismissOverlayMode" |
|||
IsChecked="{Binding UseLightDismissOverlayMode, ElementName=SplitView}" /> |
|||
|
|||
<ToggleSwitch OffContent="Left" OnContent="Right" Content="Placement" IsChecked="{Binding !IsLeft}" /> |
|||
|
|||
<TextBlock Text="DisplayMode" /> |
|||
<ComboBox Name="DisplayModeSelector" Width="170" Margin="10" SelectedIndex="{Binding DisplayMode}"> |
|||
<ComboBoxItem>Inline</ComboBoxItem> |
|||
<ComboBoxItem>CompactInline</ComboBoxItem> |
|||
<ComboBoxItem>Overlay</ComboBoxItem> |
|||
<ComboBoxItem>CompactOverlay</ComboBoxItem> |
|||
</ComboBox> |
|||
|
|||
<TextBlock Text="PaneBackground" /> |
|||
<ComboBox Name="PaneBackgroundSelector" SelectedIndex="0" Width="170" Margin="10"> |
|||
<ComboBoxItem Tag="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}">SystemControlBackgroundChromeMediumLowBrush</ComboBoxItem> |
|||
<ComboBoxItem Tag="Red">Red</ComboBoxItem> |
|||
<ComboBoxItem Tag="Blue">Blue</ComboBoxItem> |
|||
<ComboBoxItem Tag="Green">Green</ComboBoxItem> |
|||
</ComboBox> |
|||
|
|||
<TextBlock Text="{Binding Value, ElementName=OpenPaneLengthSlider, StringFormat='{}OpenPaneLength: {0}'}" /> |
|||
<Slider Name="OpenPaneLengthSlider" Value="256" Minimum="128" Maximum="500" |
|||
Width="150" /> |
|||
|
|||
<TextBlock Text="{Binding Value, ElementName=CompactPaneLengthSlider, StringFormat='{}CompactPaneLength: {0}'}" /> |
|||
<Slider Name="CompactPaneLengthSlider" Value="48" Minimum="24" Maximum="128" |
|||
Width="150" /> |
|||
|
|||
</StackPanel> |
|||
|
|||
<Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}" |
|||
BorderThickness="1"> |
|||
<!--{Binding SelectedItem.Tag, ElementName=PaneBackgroundSelector}--> |
|||
<SplitView Name="SplitView" |
|||
PanePlacement="{Binding PanePlacement}" |
|||
PaneBackground="{Binding SelectedItem.Tag, ElementName=PaneBackgroundSelector}" |
|||
OpenPaneLength="{Binding Value, ElementName=OpenPaneLengthSlider}" |
|||
CompactPaneLength="{Binding Value, ElementName=CompactPaneLengthSlider}" |
|||
DisplayMode="{Binding CurrentDisplayMode}"> |
|||
<SplitView.Pane> |
|||
<Grid> |
|||
<Grid.RowDefinitions> |
|||
<RowDefinition Height="Auto" /> |
|||
<RowDefinition Height="*" /> |
|||
<RowDefinition Height="Auto" /> |
|||
</Grid.RowDefinitions> |
|||
<TextBlock Text="PANE CONTENT" FontWeight="Bold" Name="PaneHeader" Margin="5,12,0,0" /> |
|||
<ListBoxItem Grid.Row="1" VerticalAlignment="Top" Margin="0 10"> |
|||
<StackPanel Orientation="Horizontal"> |
|||
<!--Path glyph from materialdesignicons.com--> |
|||
<Border Width="48"> |
|||
<Viewbox Width="24" Height="24" HorizontalAlignment="Left"> |
|||
<Canvas Width="24" Height="24"> |
|||
<Path Fill="{DynamicResource SystemControlForegroundBaseHighBrush}" Data="M16 17V19H2V17S2 13 9 13 16 17 16 17M12.5 7.5A3.5 3.5 0 1 0 9 11A3.5 3.5 0 0 0 12.5 7.5M15.94 13A5.32 5.32 0 0 1 18 17V19H22V17S22 13.37 15.94 13M15 4A3.39 3.39 0 0 0 13.07 4.59A5 5 0 0 1 13.07 10.41A3.39 3.39 0 0 0 15 11A3.5 3.5 0 0 0 15 4Z" /> |
|||
</Canvas> |
|||
</Viewbox> |
|||
</Border> |
|||
<TextBlock Text="People" VerticalAlignment="Center" /> |
|||
</StackPanel> |
|||
</ListBoxItem> |
|||
<TextBlock Grid.Row="2" Text="Item at bottom" Margin="60,12" /> |
|||
</Grid> |
|||
</SplitView.Pane> |
|||
|
|||
<Grid> |
|||
<TextBlock FontSize="14" FontWeight="700" Text="SplitViewContent" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" /> |
|||
<TextBlock FontSize="14" FontWeight="700" Text="SplitViewContent" TextAlignment="Left" Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" /> |
|||
<TextBlock FontSize="14" FontWeight="700" Text="SplitViewContent" HorizontalAlignment="Right" TextAlignment="Left" Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" /> |
|||
<TextBlock FontSize="14" FontWeight="700" Text="SplitViewContent" VerticalAlignment="Bottom" TextAlignment="Left" Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" /> |
|||
<TextBlock FontSize="14" FontWeight="700" Text="SplitViewContent" VerticalAlignment="Bottom" HorizontalAlignment="Right" TextAlignment="Left" Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" /> |
|||
</Grid> |
|||
|
|||
</SplitView> |
|||
</Border> |
|||
|
|||
</Grid> |
|||
</Border> |
|||
|
|||
</UserControl> |
|||
@ -0,0 +1,21 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
using ControlCatalog.ViewModels; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class SplitViewPage : UserControl |
|||
{ |
|||
public SplitViewPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
DataContext = new SplitViewPageViewModel(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="ControlCatalog.Pages.ToggleSwitchPage" Margin="5"> |
|||
<StackPanel Width="500" HorizontalAlignment="Center"> |
|||
<TextBlock Text="Simple ToggleSwitch" Classes="header"/> |
|||
<Border Classes="Thin"> |
|||
<StackPanel> |
|||
<ToggleSwitch Margin="10"/> |
|||
<TextBox Text="<ToggleSwitch/>" Classes="CodeBox"/> |
|||
</StackPanel> |
|||
</Border> |
|||
|
|||
<TextBlock Text="headered ToggleSwitch" Classes="header"/> |
|||
|
|||
<Border Classes="Thin"> |
|||
<StackPanel> |
|||
<ToggleSwitch Content="headered" IsChecked="true" Margin="10"/> |
|||
<TextBox Classes="CodeBox" |
|||
Text="<ToggleSwitch>headered</ToggleSwitch>"/> |
|||
</StackPanel> |
|||
</Border> |
|||
|
|||
<TextBlock Text="Custom content ToggleSwitch" Classes="header"/> |
|||
|
|||
<Border Classes="Thin"> |
|||
<StackPanel> |
|||
<ToggleSwitch Content="Custom" |
|||
OnContent="On" |
|||
OffContent="Off" |
|||
Margin="10"/> |
|||
|
|||
<TextBox Text="<ToggleSwitch Content="Custom" |
|||
ContentOn="On" |
|||
ContentOff="Off" />" |
|||
Classes="CodeBox"/> |
|||
</StackPanel> |
|||
</Border> |
|||
|
|||
<TextBlock Text="Image content ToggleSwitch" Classes="header"/> |
|||
|
|||
<Border Classes="Thin"> |
|||
<StackPanel> |
|||
<ToggleSwitch Content="Just Click!" Margin="10"> |
|||
<ToggleSwitch.OnContent> |
|||
<Image Source="/Assets/hirsch-899118_640.jpg" Height="32"/> |
|||
</ToggleSwitch.OnContent> |
|||
|
|||
<ToggleSwitch.OffContent> |
|||
<Image Source="/Assets/delicate-arch-896885_640.jpg" Height="32"/> |
|||
</ToggleSwitch.OffContent> |
|||
|
|||
</ToggleSwitch> |
|||
</StackPanel> |
|||
</Border> |
|||
</StackPanel> |
|||
|
|||
<UserControl.Styles > |
|||
<Style Selector="TextBox.CodeBox" > |
|||
<Setter Property="Padding" Value="10"/> |
|||
<Setter Property="IsReadOnly" Value="True"/> |
|||
<Setter Property="BorderBrush" Value="Transparent"/> |
|||
<Setter Property="FontSize" Value="14"/> |
|||
<Setter Property="IsEnabled" Value="true"/> |
|||
</Style> |
|||
|
|||
<Style Selector="TextBlock.header"> |
|||
<Setter Property="FontSize" Value="18"/> |
|||
<Setter Property="Margin" Value="0 20 0 20"/> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Thin"> |
|||
<Setter Property="BorderBrush" Value="Gray"/> |
|||
<Setter Property="BorderThickness" Value="0.5"/> |
|||
<Setter Property="CornerRadius" Value="2"/> |
|||
</Style> |
|||
|
|||
</UserControl.Styles> |
|||
</UserControl> |
|||
|
|||
@ -0,0 +1,19 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class ToggleSwitchPage : UserControl |
|||
{ |
|||
public ToggleSwitchPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
<UserControl xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
|||
x:Class="ControlCatalog.Pages.WindowCustomizationsPage"> |
|||
<StackPanel Spacing="10" Margin="25"> |
|||
<CheckBox Content="Extend Client Area to Decorations" IsChecked="{Binding ExtendClientAreaEnabled}" /> |
|||
<CheckBox Content="Title Bar" IsChecked="{Binding SystemTitleBarEnabled}" /> |
|||
<CheckBox Content="Prefer System Chrome" IsChecked="{Binding PreferSystemChromeEnabled}" /> |
|||
<Slider Minimum="-1" Maximum="200" Value="{Binding TitleBarHeight}" /> |
|||
<ComboBox x:Name="TransparencyLevels" SelectedIndex="{Binding TransparencyLevel}"> |
|||
<ComboBoxItem>None</ComboBoxItem> |
|||
<ComboBoxItem>Transparent</ComboBoxItem> |
|||
<ComboBoxItem>Blur</ComboBoxItem> |
|||
<ComboBoxItem>AcrylicBlur</ComboBoxItem> |
|||
</ComboBox> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,19 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class WindowCustomizationsPage : UserControl |
|||
{ |
|||
public WindowCustomizationsPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
using System; |
|||
using Avalonia.Controls; |
|||
using ReactiveUI; |
|||
|
|||
namespace ControlCatalog.ViewModels |
|||
{ |
|||
public class SplitViewPageViewModel : ReactiveObject |
|||
{ |
|||
private bool _isLeft = true; |
|||
private int _displayMode = 3; //CompactOverlay
|
|||
|
|||
public bool IsLeft |
|||
{ |
|||
get => _isLeft; |
|||
set |
|||
{ |
|||
this.RaiseAndSetIfChanged(ref _isLeft, value); |
|||
this.RaisePropertyChanged(nameof(PanePlacement)); |
|||
} |
|||
} |
|||
|
|||
public int DisplayMode |
|||
{ |
|||
get => _displayMode; |
|||
set |
|||
{ |
|||
this.RaiseAndSetIfChanged(ref _displayMode, value); |
|||
this.RaisePropertyChanged(nameof(CurrentDisplayMode)); |
|||
} |
|||
} |
|||
|
|||
public SplitViewPanePlacement PanePlacement => _isLeft ? SplitViewPanePlacement.Left : SplitViewPanePlacement.Right; |
|||
|
|||
public SplitViewDisplayMode CurrentDisplayMode |
|||
{ |
|||
get |
|||
{ |
|||
if (Enum.IsDefined(typeof(SplitViewDisplayMode), _displayMode)) |
|||
{ |
|||
return (SplitViewDisplayMode)_displayMode; |
|||
} |
|||
return SplitViewDisplayMode.CompactOverlay; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,115 @@ |
|||
<UserControl |
|||
xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="RenderDemo.Pages.TransitionsPage"> |
|||
<UserControl.Styles> |
|||
<Styles> |
|||
<Styles.Resources> |
|||
<Template x:Key="Acorn"> |
|||
<Path Fill="White" Stretch="Uniform" |
|||
Data="F1 M 16.6309,18.6563C 17.1309, |
|||
8.15625 29.8809,14.1563 29.8809, |
|||
14.1563C 30.8809,11.1563 34.1308, |
|||
11.4063 34.1308,11.4063C 33.5,12 |
|||
34.6309,13.1563 34.6309,13.1563C |
|||
32.1309,13.1562 31.1309,14.9062 |
|||
31.1309,14.9062C 41.1309,23.9062 |
|||
32.6309,27.9063 32.6309,27.9062C |
|||
24.6309,24.9063 21.1309,22.1562 |
|||
16.6309,18.6563 Z M 16.6309,19.9063C |
|||
21.6309,24.1563 25.1309,26.1562 |
|||
31.6309,28.6562C 31.6309,28.6562 |
|||
26.3809,39.1562 18.3809,36.1563C |
|||
18.3809,36.1563 18,38 16.3809,36.9063C |
|||
15,36 16.3809,34.9063 16.3809,34.9063C |
|||
16.3809,34.9063 10.1309,30.9062 16.6309,19.9063 Z"/> |
|||
</Template> |
|||
<Template x:Key="Heart"> |
|||
<Path Fill="Red" Stretch="Uniform" Data=" |
|||
M 272.70141,238.71731 |
|||
C 206.46141,238.71731 152.70146,292.4773 152.70146,358.71731 |
|||
C 152.70146,493.47282 288.63461,528.80461 381.26391,662.02535 |
|||
C 468.83815,529.62199 609.82641,489.17075 609.82641,358.71731 |
|||
C 609.82641,292.47731 556.06651,238.7173 489.82641,238.71731 |
|||
C 441.77851,238.71731 400.42481,267.08774 381.26391,307.90481 |
|||
C 362.10311,267.08773 320.74941,238.7173 272.70141,238.71731 z "/> |
|||
</Template> |
|||
</Styles.Resources> |
|||
|
|||
<Style Selector="Border.Test"> |
|||
<Setter Property="Margin" Value="15"/> |
|||
<Setter Property="Width" Value="100"/> |
|||
<Setter Property="Height" Value="100"/> |
|||
<Setter Property="Child" Value="{StaticResource Acorn}"/> |
|||
<Setter Property="Transitions"> |
|||
<Transitions> |
|||
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:1" /> |
|||
</Transitions> |
|||
</Setter> |
|||
<Setter Property="RenderTransform" Value="none" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect1:pointerover"> |
|||
<Setter Property="RenderTransform" Value="rotate(120deg) scale(1.5)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect2:pointerover"> |
|||
<Setter Property="RenderTransform" Value="scale(0.8)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect3"> |
|||
<Setter Property="Child" Value="{StaticResource Heart}"/> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect3:pointerover"> |
|||
<Setter Property="RenderTransform" Value="rotate(1turn)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect4:pointerover"> |
|||
<Setter Property="RenderTransform" Value="translateY(-100px)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect5:pointerover"> |
|||
<Setter Property="RenderTransform" Value="skewX(-20deg)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect5:pointerover"> |
|||
<Setter Property="RenderTransform" Value="skewX(-20deg)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect6"> |
|||
<Setter Property="Transitions"> |
|||
<Transitions> |
|||
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.5" Delay="0:0:1"/> |
|||
</Transitions> |
|||
</Setter> |
|||
<Setter Property="RenderTransform" Value="scale(0.8)" /> |
|||
</Style> |
|||
|
|||
<Style Selector="Border.Rect6:pointerover"> |
|||
<Setter Property="RenderTransform" Value="none" /> |
|||
</Style> |
|||
|
|||
</Styles> |
|||
</UserControl.Styles> |
|||
|
|||
<Grid> |
|||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" ClipToBounds="False"> |
|||
<StackPanel.Clock> |
|||
<Clock /> |
|||
</StackPanel.Clock> |
|||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"> |
|||
<TextBlock VerticalAlignment="Center">Hover to activate Transform Keyframe Animations.</TextBlock> |
|||
<Button Content="{Binding PlayStateText}" Command="{Binding TogglePlayState}" Click="ToggleClock" /> |
|||
</StackPanel> |
|||
<WrapPanel ClipToBounds="False"> |
|||
<Border Classes="Test Rect1" Background="DarkRed"/> |
|||
<Border Classes="Test Rect2" Background="Magenta"/> |
|||
<Border Classes="Test Rect3"/> |
|||
<Border Classes="Test Rect4" Background="Navy"/> |
|||
<Border Classes="Test Rect5" Background="SeaGreen"/> |
|||
<Border Classes="Test Rect6" Background="Orange"/> |
|||
</WrapPanel> |
|||
</StackPanel> |
|||
</Grid> |
|||
</UserControl> |
|||
@ -0,0 +1,37 @@ |
|||
using Avalonia.Animation; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Markup.Xaml; |
|||
using RenderDemo.ViewModels; |
|||
|
|||
namespace RenderDemo.Pages |
|||
{ |
|||
public class TransitionsPage : UserControl |
|||
{ |
|||
public TransitionsPage() |
|||
{ |
|||
InitializeComponent(); |
|||
this.DataContext = new AnimationsPageViewModel(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
|
|||
private void ToggleClock(object sender, RoutedEventArgs args) |
|||
{ |
|||
var button = sender as Button; |
|||
var clock = button.Clock; |
|||
|
|||
if (clock.PlayState == PlayState.Run) |
|||
{ |
|||
clock.PlayState = PlayState.Pause; |
|||
} |
|||
else if (clock.PlayState == PlayState.Pause) |
|||
{ |
|||
clock.PlayState = PlayState.Run; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
<Application xmlns="https://github.com/avaloniaui" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="NativeEmbedSample.App"> |
|||
<Application.Styles> |
|||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/> |
|||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/> |
|||
</Application.Styles> |
|||
</Application> |
|||
@ -0,0 +1,22 @@ |
|||
using Avalonia; |
|||
using Avalonia.Controls.ApplicationLifetimes; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace NativeEmbedSample |
|||
{ |
|||
public class App : Application |
|||
{ |
|||
public override void Initialize() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
} |
|||
|
|||
public override void OnFrameworkInitializationCompleted() |
|||
{ |
|||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) |
|||
desktopLifetime.MainWindow = new MainWindow(); |
|||
|
|||
base.OnFrameworkInitializationCompleted(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,121 @@ |
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.IO; |
|||
using System.Runtime.InteropServices; |
|||
using System.Text; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Platform; |
|||
using Avalonia.Threading; |
|||
using MonoMac.AppKit; |
|||
using MonoMac.Foundation; |
|||
using MonoMac.WebKit; |
|||
using Encoding = SharpDX.Text.Encoding; |
|||
|
|||
namespace NativeEmbedSample |
|||
{ |
|||
public class EmbedSample : NativeControlHost |
|||
{ |
|||
public bool IsSecond { get; set; } |
|||
private Process _mplayer; |
|||
|
|||
IPlatformHandle CreateLinux(IPlatformHandle parent) |
|||
{ |
|||
if (IsSecond) |
|||
{ |
|||
var chooser = GtkHelper.CreateGtkFileChooser(parent.Handle); |
|||
if (chooser != null) |
|||
return chooser; |
|||
} |
|||
|
|||
var control = base.CreateNativeControlCore(parent); |
|||
var nodes = Path.GetFullPath(Path.Combine(typeof(EmbedSample).Assembly.GetModules()[0].FullyQualifiedName, |
|||
"..", |
|||
"nodes.mp4")); |
|||
_mplayer = Process.Start(new ProcessStartInfo("mplayer", |
|||
$"-vo x11 -zoom -loop 0 -wid {control.Handle.ToInt64()} \"{nodes}\"") |
|||
{ |
|||
UseShellExecute = false, |
|||
|
|||
}); |
|||
return control; |
|||
} |
|||
|
|||
void DestroyLinux(IPlatformHandle handle) |
|||
{ |
|||
_mplayer?.Kill(); |
|||
_mplayer = null; |
|||
base.DestroyNativeControlCore(handle); |
|||
} |
|||
|
|||
private const string RichText = |
|||
@"{\rtf1\ansi\ansicpg1251\deff0\nouicompat\deflang1049{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
|
|||
{\colortbl ;\red255\green0\blue0;\red0\green77\blue187;\red0\green176\blue80;\red155\green0\blue211;\red247\green150\blue70;\red75\green172\blue198;} |
|||
{\*\generator Riched20 6.3.9600}\viewkind4\uc1 |
|||
\pard\sa200\sl276\slmult1\f0\fs22\lang9 <PREFIX>I \i am\i0 a \cf1\b Rich Text \cf0\b0\fs24 control\cf2\fs28 !\cf3\fs32 !\cf4\fs36 !\cf1\fs40 !\cf5\fs44 !\cf6\fs48 !\cf0\fs44\par |
|||
}";
|
|||
|
|||
IPlatformHandle CreateWin32(IPlatformHandle parent) |
|||
{ |
|||
WinApi.LoadLibrary("Msftedit.dll"); |
|||
var handle = WinApi.CreateWindowEx(0, "RICHEDIT50W", |
|||
@"Rich Edit", |
|||
0x800000 | 0x10000000 | 0x40000000 | 0x800000 | 0x10000 | 0x0004, 0, 0, 1, 1, parent.Handle, |
|||
IntPtr.Zero, WinApi.GetModuleHandle(null), IntPtr.Zero); |
|||
var st = new WinApi.SETTEXTEX { Codepage = 65001, Flags = 0x00000008 }; |
|||
var text = RichText.Replace("<PREFIX>", IsSecond ? "\\qr " : ""); |
|||
var bytes = Encoding.UTF8.GetBytes(text); |
|||
WinApi.SendMessage(handle, 0x0400 + 97, ref st, bytes); |
|||
return new PlatformHandle(handle, "HWND"); |
|||
|
|||
} |
|||
|
|||
void DestroyWin32(IPlatformHandle handle) |
|||
{ |
|||
WinApi.DestroyWindow(handle.Handle); |
|||
} |
|||
|
|||
IPlatformHandle CreateOSX(IPlatformHandle parent) |
|||
{ |
|||
// Note: We are using MonoMac for example purposes
|
|||
// It shouldn't be used in production apps
|
|||
MacHelper.EnsureInitialized(); |
|||
|
|||
var webView = new WebView(); |
|||
Dispatcher.UIThread.Post(() => |
|||
{ |
|||
webView.MainFrame.LoadRequest(new NSUrlRequest(new NSUrl( |
|||
IsSecond ? "https://bing.com": "https://google.com/"))); |
|||
}); |
|||
return new MacOSViewHandle(webView); |
|||
|
|||
} |
|||
|
|||
void DestroyOSX(IPlatformHandle handle) |
|||
{ |
|||
((MacOSViewHandle)handle).Dispose(); |
|||
} |
|||
|
|||
protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle parent) |
|||
{ |
|||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|||
return CreateLinux(parent); |
|||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
|||
return CreateWin32(parent); |
|||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) |
|||
return CreateOSX(parent); |
|||
return base.CreateNativeControlCore(parent); |
|||
} |
|||
|
|||
protected override void DestroyNativeControlCore(IPlatformHandle control) |
|||
{ |
|||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) |
|||
DestroyLinux(control); |
|||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) |
|||
DestroyWin32(control); |
|||
else if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) |
|||
DestroyOSX(control); |
|||
else |
|||
base.DestroyNativeControlCore(control); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Avalonia.Controls.Platform; |
|||
using Avalonia.Platform; |
|||
using Avalonia.Platform.Interop; |
|||
using Avalonia.X11.NativeDialogs; |
|||
using static Avalonia.X11.NativeDialogs.Gtk; |
|||
using static Avalonia.X11.NativeDialogs.Glib; |
|||
namespace NativeEmbedSample |
|||
{ |
|||
public class GtkHelper |
|||
{ |
|||
private static Task<bool> s_gtkTask; |
|||
class FileChooser : INativeControlHostDestroyableControlHandle |
|||
{ |
|||
private readonly IntPtr _widget; |
|||
|
|||
public FileChooser(IntPtr widget, IntPtr xid) |
|||
{ |
|||
_widget = widget; |
|||
Handle = xid; |
|||
} |
|||
|
|||
public IntPtr Handle { get; } |
|||
public string HandleDescriptor => "XID"; |
|||
public void Destroy() |
|||
{ |
|||
RunOnGlibThread(() => |
|||
{ |
|||
gtk_widget_destroy(_widget); |
|||
return 0; |
|||
}).Wait(); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
public static IPlatformHandle CreateGtkFileChooser(IntPtr parentXid) |
|||
{ |
|||
if (s_gtkTask == null) |
|||
s_gtkTask = StartGtk(); |
|||
if (!s_gtkTask.Result) |
|||
return null; |
|||
return RunOnGlibThread(() => |
|||
{ |
|||
using (var title = new Utf8Buffer("Embedded")) |
|||
{ |
|||
var widget = gtk_file_chooser_dialog_new(title, IntPtr.Zero, GtkFileChooserAction.SelectFolder, |
|||
IntPtr.Zero); |
|||
gtk_widget_realize(widget); |
|||
var xid = gdk_x11_window_get_xid(gtk_widget_get_window(widget)); |
|||
gtk_window_present(widget); |
|||
return new FileChooser(widget, xid); |
|||
} |
|||
}).Result; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using Avalonia.Platform; |
|||
using MonoMac.AppKit; |
|||
|
|||
namespace NativeEmbedSample |
|||
{ |
|||
public class MacHelper |
|||
{ |
|||
private static bool _isInitialized; |
|||
|
|||
public static void EnsureInitialized() |
|||
{ |
|||
if (_isInitialized) |
|||
return; |
|||
_isInitialized = true; |
|||
NSApplication.Init(); |
|||
} |
|||
} |
|||
|
|||
class MacOSViewHandle : IPlatformHandle, IDisposable |
|||
{ |
|||
private NSView _view; |
|||
|
|||
public MacOSViewHandle(NSView view) |
|||
{ |
|||
_view = view; |
|||
} |
|||
|
|||
public IntPtr Handle => _view?.Handle ?? IntPtr.Zero; |
|||
public string HandleDescriptor => "NSView"; |
|||
|
|||
public void Dispose() |
|||
{ |
|||
_view.Dispose(); |
|||
_view = null; |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,52 @@ |
|||
<Window xmlns="https://github.com/avaloniaui" MinWidth="500" MinHeight="300" |
|||
Width="1024" Height="800" |
|||
Title="Native embedding sample" |
|||
xmlns:local="clr-namespace:NativeEmbedSample" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
x:Class="NativeEmbedSample.MainWindow"> |
|||
<DockPanel> |
|||
<Menu DockPanel.Dock="Top"> |
|||
<MenuItem Header="Test"> |
|||
<MenuItem Header="SubMenu"> |
|||
<MenuItem Header="Item 1"/> |
|||
<MenuItem Header="Item 2"/> |
|||
<MenuItem Header="Item 3"/> |
|||
</MenuItem> |
|||
<MenuItem Header="Item 1"/> |
|||
<MenuItem Header="Item 2"/> |
|||
<MenuItem Header="Item 3"/> |
|||
</MenuItem> |
|||
</Menu> |
|||
<DockPanel DockPanel.Dock="Top"> |
|||
<Button DockPanel.Dock="Right" Click="ShowPopupDelay">Show popup (delay)</Button> |
|||
<Button DockPanel.Dock="Right" Click="ShowPopup">Show popup</Button> |
|||
<Border DockPanel.Dock="Right" Background="#c0c0c0"> |
|||
<ToolTip.Tip> |
|||
<ToolTip> |
|||
<TextBlock>Text</TextBlock> |
|||
</ToolTip> |
|||
</ToolTip.Tip> |
|||
<TextBlock>Tooltip</TextBlock> |
|||
</Border> |
|||
<TextBox Text="Lorem ipsum dolor sit amet"/> |
|||
|
|||
</DockPanel> |
|||
<Grid ColumnDefinitions="*,5,*"> |
|||
<DockPanel> |
|||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> |
|||
<CheckBox x:Name="firstVisible" IsChecked="True"/> |
|||
<TextBlock>Visible</TextBlock> |
|||
</StackPanel> |
|||
<local:EmbedSample IsVisible="{Binding #firstVisible.IsChecked}"/> |
|||
</DockPanel> |
|||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" /> |
|||
<DockPanel Grid.Column="2"> |
|||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> |
|||
<CheckBox x:Name="secondVisible" IsChecked="True"/> |
|||
<TextBlock>Visible</TextBlock> |
|||
</StackPanel> |
|||
<local:EmbedSample IsSecond="True" IsVisible="{Binding #secondVisible.IsChecked}"/> |
|||
</DockPanel> |
|||
</Grid> |
|||
</DockPanel> |
|||
</Window> |
|||
@ -0,0 +1,36 @@ |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Avalonia; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Interactivity; |
|||
using Avalonia.Markup.Xaml; |
|||
|
|||
namespace NativeEmbedSample |
|||
{ |
|||
public class MainWindow : Window |
|||
{ |
|||
public MainWindow() |
|||
{ |
|||
AvaloniaXamlLoader.Load(this); |
|||
this.AttachDevTools(); |
|||
} |
|||
|
|||
public async void ShowPopupDelay(object sender, RoutedEventArgs args) |
|||
{ |
|||
await Task.Delay(3000); |
|||
ShowPopup(sender, args); |
|||
} |
|||
|
|||
public void ShowPopup(object sender, RoutedEventArgs args) |
|||
{ |
|||
|
|||
new ContextMenu() |
|||
{ |
|||
Items = new List<MenuItem> |
|||
{ |
|||
new MenuItem() { Header = "Test" }, new MenuItem() { Header = "Test" } |
|||
} |
|||
}.Open((Control)sender); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<PropertyGroup> |
|||
<OutputType>Exe</OutputType> |
|||
<TargetFramework>netcoreapp2.0</TargetFramework> |
|||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> |
|||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="MonoMac.NetStandard" Version="0.0.4" /> |
|||
<ProjectReference Include="..\..\..\src\Avalonia.Desktop\Avalonia.Desktop.csproj" /> |
|||
<ProjectReference Include="..\..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" /> |
|||
<ProjectReference Include="..\..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
|||
<ProjectReference Include="..\..\..\src\Avalonia.X11\Avalonia.X11.csproj" /> |
|||
<PackageReference Include="Avalonia.Angle.Windows.Natives" Version="2.1.0.2019013001" /> |
|||
|
|||
<AvaloniaResource Include="**\*.xaml"> |
|||
<SubType>Designer</SubType> |
|||
</AvaloniaResource> |
|||
<None Remove="nodes.mp4" /> |
|||
<Content Include="nodes.mp4"> |
|||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|||
</Content> |
|||
<Compile Include="..\..\..\src\Avalonia.X11\NativeDialogs\Gtk.cs" /> |
|||
</ItemGroup> |
|||
|
|||
<Import Project="..\..\..\build\SampleApp.props" /> |
|||
<Import Project="..\..\..\build\BuildTargets.targets" /> |
|||
<Import Project="..\..\..\build\ReferenceCoreLibraries.props" /> |
|||
</Project> |
|||
@ -0,0 +1,17 @@ |
|||
using Avalonia; |
|||
|
|||
namespace NativeEmbedSample |
|||
{ |
|||
class Program |
|||
{ |
|||
static int Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); |
|||
|
|||
public static AppBuilder BuildAvaloniaApp() |
|||
=> AppBuilder.Configure<App>() |
|||
.With(new AvaloniaNativePlatformOptions() |
|||
{ |
|||
}) |
|||
.UsePlatformDetect(); |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
using System; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
namespace NativeEmbedSample |
|||
{ |
|||
public unsafe class WinApi |
|||
{ |
|||
public enum CommonControls : uint |
|||
{ |
|||
ICC_LISTVIEW_CLASSES = 0x00000001, // listview, header
|
|||
ICC_TREEVIEW_CLASSES = 0x00000002, // treeview, tooltips
|
|||
ICC_BAR_CLASSES = 0x00000004, // toolbar, statusbar, trackbar, tooltips
|
|||
ICC_TAB_CLASSES = 0x00000008, // tab, tooltips
|
|||
ICC_UPDOWN_CLASS = 0x00000010, // updown
|
|||
ICC_PROGRESS_CLASS = 0x00000020, // progress
|
|||
ICC_HOTKEY_CLASS = 0x00000040, // hotkey
|
|||
ICC_ANIMATE_CLASS = 0x00000080, // animate
|
|||
ICC_WIN95_CLASSES = 0x000000FF, |
|||
ICC_DATE_CLASSES = 0x00000100, // month picker, date picker, time picker, updown
|
|||
ICC_USEREX_CLASSES = 0x00000200, // comboex
|
|||
ICC_COOL_CLASSES = 0x00000400, // rebar (coolbar) control
|
|||
ICC_INTERNET_CLASSES = 0x00000800, |
|||
ICC_PAGESCROLLER_CLASS = 0x00001000, // page scroller
|
|||
ICC_NATIVEFNTCTL_CLASS = 0x00002000, // native font control
|
|||
ICC_STANDARD_CLASSES = 0x00004000, |
|||
ICC_LINK_CLASS = 0x00008000 |
|||
} |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct INITCOMMONCONTROLSEX |
|||
{ |
|||
public int dwSize; |
|||
public uint dwICC; |
|||
} |
|||
|
|||
[DllImport("Comctl32.dll")] |
|||
public static extern void InitCommonControlsEx(ref INITCOMMONCONTROLSEX init); |
|||
|
|||
[DllImport("user32.dll", SetLastError = true)] |
|||
public static extern bool DestroyWindow(IntPtr hwnd); |
|||
|
|||
[DllImport("kernel32.dll")] |
|||
public static extern IntPtr LoadLibrary(string lib); |
|||
|
|||
|
|||
[DllImport("kernel32.dll")] |
|||
public static extern IntPtr GetModuleHandle(string lpModuleName); |
|||
|
|||
[DllImport("user32.dll", SetLastError = true)] |
|||
public static extern IntPtr CreateWindowEx( |
|||
int dwExStyle, |
|||
string lpClassName, |
|||
string lpWindowName, |
|||
uint dwStyle, |
|||
int x, |
|||
int y, |
|||
int nWidth, |
|||
int nHeight, |
|||
IntPtr hWndParent, |
|||
IntPtr hMenu, |
|||
IntPtr hInstance, |
|||
IntPtr lpParam); |
|||
|
|||
[StructLayout(LayoutKind.Sequential)] |
|||
public struct SETTEXTEX |
|||
{ |
|||
public uint Flags; |
|||
public uint Codepage; |
|||
} |
|||
|
|||
[DllImport("user32.dll", CharSet = CharSet.Unicode, EntryPoint = "SendMessageW")] |
|||
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, ref SETTEXTEX wParam, byte[] lParam); |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue