487 changed files with 12775 additions and 5133 deletions
@ -1 +1 @@ |
|||
.\build-version.ps1 0.1.1-alpha2 |
|||
.\build-version.ps1 0.2.0-alpha3 |
|||
@ -0,0 +1 @@ |
|||
$Packages = @("Perspex", "Perspex.Desktop", "Perspex.Skia.Desktop", "Perspex.Android", "Perspex.iOS") |
|||
@ -0,0 +1,27 @@ |
|||
<?xml version="1.0"?> |
|||
<package> |
|||
<metadata> |
|||
<id>Perspex.iOS</id> |
|||
<version>#VERSION#</version> |
|||
<authors>Perspex Team</authors> |
|||
<owners>stevenk</owners> |
|||
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl> |
|||
<projectUrl>https://github.com/Perspex/Perspex/</projectUrl> |
|||
<requireLicenseAcceptance>false</requireLicenseAcceptance> |
|||
<description>The Perspex UI framework</description> |
|||
<releaseNotes></releaseNotes> |
|||
<copyright>Copyright 2015</copyright> |
|||
<tags>Perspex</tags> |
|||
<dependencies> |
|||
<dependency id="Serilog" version="1.5.9" /> |
|||
<dependency id="Splat" version="1.6.2" /> |
|||
<dependency id="Sprache" version="2.0.0.47" /> |
|||
<dependency id="Rx-Core" version="2.2.5" /> |
|||
<dependency id="Rx-Interfaces" version="2.2.5" /> |
|||
<dependency id="Rx-Linq" version="2.2.5" /> |
|||
<dependency id="Rx-Main" version="2.2.5" /> |
|||
<dependency id="Rx-PlatformServices" version="2.2.5" /> |
|||
<dependency id="Perspex" version="#VERSION#" /> |
|||
</dependencies> |
|||
</metadata> |
|||
</package> |
|||
@ -0,0 +1,3 @@ |
|||
<UserControl xmlns="https://github.com/perspex"> |
|||
<TextBlock Text="{Binding Content}"/> |
|||
</UserControl> |
|||
@ -0,0 +1,18 @@ |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace BindingTest |
|||
{ |
|||
public class TestUserControl : UserControl |
|||
{ |
|||
public TestUserControl() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using ReactiveUI; |
|||
|
|||
namespace BindingTest.ViewModels |
|||
{ |
|||
public class TestUserControlViewModel : ReactiveObject |
|||
{ |
|||
public string Content { get; } = "User Control Content"; |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<configuration> |
|||
<startup> |
|||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /> |
|||
</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> |
|||
</assemblyBinding> |
|||
</runtime> |
|||
</configuration> |
|||
@ -0,0 +1,16 @@ |
|||
<Application xmlns="https://github.com/perspex"> |
|||
<Application.Styles> |
|||
<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.paml"/> |
|||
</Application.Styles> |
|||
</Application> |
|||
@ -0,0 +1,55 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using Perspex; |
|||
using Perspex.Controls; |
|||
using Perspex.Diagnostics; |
|||
using Perspex.Markup.Xaml; |
|||
using Perspex.Themes.Default; |
|||
|
|||
namespace ControlCatalog |
|||
{ |
|||
class App : Application |
|||
{ |
|||
public App() |
|||
{ |
|||
RegisterServices(); |
|||
InitializeSubsystems(GetPlatformId()); |
|||
Styles = new DefaultTheme(); |
|||
InitializeComponent(); |
|||
} |
|||
|
|||
public static void AttachDevTools(Window window) |
|||
{ |
|||
#if DEBUG
|
|||
DevTools.Attach(window); |
|||
#endif
|
|||
} |
|||
|
|||
static void Main(string[] args) |
|||
{ |
|||
var app = new App(); |
|||
var window = new MainWindow(); |
|||
window.Show(); |
|||
app.Run(window); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
|
|||
private int GetPlatformId() |
|||
{ |
|||
var args = Environment.GetCommandLineArgs(); |
|||
|
|||
if (args.Contains("--gtk")) |
|||
{ |
|||
return (int)PlatformID.Unix; |
|||
} |
|||
else |
|||
{ |
|||
return (int)Environment.OSVersion.Platform; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 212 KiB |
|
After Width: | Height: | Size: 111 KiB |
@ -0,0 +1,190 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|||
<PropertyGroup> |
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|||
<ProjectGuid>{61BEC86C-F307-4295-B5B8-9428610D7D55}</ProjectGuid> |
|||
<OutputType>WinExe</OutputType> |
|||
<AppDesignerFolder>Properties</AppDesignerFolder> |
|||
<RootNamespace>ControlCatalog</RootNamespace> |
|||
<AssemblyName>ControlCatalog</AssemblyName> |
|||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion> |
|||
<FileAlignment>512</FileAlignment> |
|||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugSymbols>true</DebugSymbols> |
|||
<DebugType>full</DebugType> |
|||
<Optimize>false</Optimize> |
|||
<OutputPath>bin\Debug\</OutputPath> |
|||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|||
<PlatformTarget>AnyCPU</PlatformTarget> |
|||
<DebugType>pdbonly</DebugType> |
|||
<Optimize>true</Optimize> |
|||
<OutputPath>bin\Release\</OutputPath> |
|||
<DefineConstants>TRACE</DefineConstants> |
|||
<ErrorReport>prompt</ErrorReport> |
|||
<WarningLevel>4</WarningLevel> |
|||
</PropertyGroup> |
|||
<PropertyGroup> |
|||
<StartupObject /> |
|||
</PropertyGroup> |
|||
<ItemGroup> |
|||
<Reference Include="System" /> |
|||
<Reference Include="System.Core" /> |
|||
<Reference Include="System.Xml.Linq" /> |
|||
<Reference Include="System.Data.DataSetExtensions" /> |
|||
<Reference Include="Microsoft.CSharp" /> |
|||
<Reference Include="System.Data" /> |
|||
<Reference Include="System.Net.Http" /> |
|||
<Reference Include="System.Xml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<Compile Include="App.paml.cs"> |
|||
<DependentUpon>App.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="MainWindow.paml.cs"> |
|||
<DependentUpon>MainWindow.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\BorderPage.paml.cs"> |
|||
<DependentUpon>BorderPage.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\CarouselPage.paml.cs"> |
|||
<DependentUpon>CarouselPage.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\CanvasPage.paml.cs"> |
|||
<DependentUpon>CanvasPage.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\ButtonPage.paml.cs"> |
|||
<DependentUpon>ButtonPage.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Pages\DropDownPage.paml.cs"> |
|||
<DependentUpon>DropDownPage.paml</DependentUpon> |
|||
</Compile> |
|||
<Compile Include="Properties\AssemblyInfo.cs" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<None Include="App.config" /> |
|||
<EmbeddedResource Include="App.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="Pages\ButtonPage.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="SideBar.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="MainWindow.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="Pages\BorderPage.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="Pages\CanvasPage.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="Pages\CarouselPage.paml"> |
|||
<SubType>Designer</SubType> |
|||
</EmbeddedResource> |
|||
<EmbeddedResource Include="Pages\DropDownPage.paml" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ProjectReference Include="..\..\src\Gtk\Perspex.Cairo\Perspex.Cairo.csproj"> |
|||
<Project>{fb05ac90-89ba-4f2f-a924-f37875fb547c}</Project> |
|||
<Name>Perspex.Cairo</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Gtk\Perspex.Gtk\Perspex.Gtk.csproj"> |
|||
<Project>{54f237d5-a70a-4752-9656-0c70b1a7b047}</Project> |
|||
<Name>Perspex.Gtk</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Perspex.Markup.Xaml\Perspex.Markup.Xaml.csproj"> |
|||
<Project>{3e53a01a-b331-47f3-b828-4a5717e77a24}</Project> |
|||
<Name>Perspex.Markup.Xaml</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Markup\Perspex.Markup\Perspex.Markup.csproj"> |
|||
<Project>{6417e941-21bc-467b-a771-0de389353ce6}</Project> |
|||
<Name>Perspex.Markup</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Animation\Perspex.Animation.csproj"> |
|||
<Project>{d211e587-d8bc-45b9-95a4-f297c8fa5200}</Project> |
|||
<Name>Perspex.Animation</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Application\Perspex.Application.csproj"> |
|||
<Project>{799a7bb5-3c2c-48b6-85a7-406a12c420da}</Project> |
|||
<Name>Perspex.Application</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Base\Perspex.Base.csproj"> |
|||
<Project>{b09b78d8-9b26-48b0-9149-d64a2f120f3f}</Project> |
|||
<Name>Perspex.Base</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Controls\Perspex.Controls.csproj"> |
|||
<Project>{d2221c82-4a25-4583-9b43-d791e3f6820c}</Project> |
|||
<Name>Perspex.Controls</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Diagnostics\Perspex.Diagnostics.csproj"> |
|||
<Project>{7062ae20-5dcc-4442-9645-8195bdece63e}</Project> |
|||
<Name>Perspex.Diagnostics</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.HtmlRenderer\Perspex.HtmlRenderer.csproj"> |
|||
<Project>{5fb2b005-0a7f-4dad-add4-3ed01444e63d}</Project> |
|||
<Name>Perspex.HtmlRenderer</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Input\Perspex.Input.csproj"> |
|||
<Project>{62024b2d-53eb-4638-b26b-85eeaa54866e}</Project> |
|||
<Name>Perspex.Input</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Interactivity\Perspex.Interactivity.csproj"> |
|||
<Project>{6b0ed19d-a08b-461c-a9d9-a9ee40b0c06b}</Project> |
|||
<Name>Perspex.Interactivity</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Layout\Perspex.Layout.csproj"> |
|||
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> |
|||
<Name>Perspex.Layout</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.ReactiveUI\Perspex.ReactiveUI.csproj"> |
|||
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project> |
|||
<Name>Perspex.ReactiveUI</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.SceneGraph\Perspex.SceneGraph.csproj"> |
|||
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> |
|||
<Name>Perspex.SceneGraph</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Styling\Perspex.Styling.csproj"> |
|||
<Project>{f1baa01a-f176-4c6a-b39d-5b40bb1b148f}</Project> |
|||
<Name>Perspex.Styling</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Perspex.Themes.Default\Perspex.Themes.Default.csproj"> |
|||
<Project>{3e10a5fa-e8da-48b1-ad44-6a5b6cb7750f}</Project> |
|||
<Name>Perspex.Themes.Default</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Perspex.Direct2D1\Perspex.Direct2D1.csproj"> |
|||
<Project>{3e908f67-5543-4879-a1dc-08eace79b3cd}</Project> |
|||
<Name>Perspex.Direct2D1</Name> |
|||
</ProjectReference> |
|||
<ProjectReference Include="..\..\src\Windows\Perspex.Win32\Perspex.Win32.csproj"> |
|||
<Project>{811a76cf-1cf6-440f-963b-bbe31bd72a82}</Project> |
|||
<Name>Perspex.Win32</Name> |
|||
</ProjectReference> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Assets\hirsch-899118_640.jpg" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<EmbeddedResource Include="Assets\delicate-arch-896885_640.jpg" /> |
|||
<EmbeddedResource Include="Assets\maple-leaf-888807_640.jpg" /> |
|||
</ItemGroup> |
|||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|||
Other similar extension points exist, see Microsoft.Common.targets. |
|||
<Target Name="BeforeBuild"> |
|||
</Target> |
|||
<Target Name="AfterBuild"> |
|||
</Target> |
|||
--> |
|||
</Project> |
|||
@ -0,0 +1,14 @@ |
|||
<Window xmlns="https://github.com/perspex" |
|||
xmlns:pages="clr-namespace:ControlCatalog.Pages;assembly=ControlCatalog" |
|||
Title="Perspex Control Gallery"> |
|||
<TabControl Classes="sidebar"> |
|||
<TabControl.Transition> |
|||
<CrossFade Duration="0.25"/> |
|||
</TabControl.Transition> |
|||
<TabItem Header="Border"><pages:BorderPage/></TabItem> |
|||
<TabItem Header="Button"><pages:ButtonPage/></TabItem> |
|||
<TabItem Header="Canvas"><pages:CanvasPage/></TabItem> |
|||
<TabItem Header="Carousel"><pages:CarouselPage/></TabItem> |
|||
<TabItem Header="DropDown"><pages:DropDownPage/></TabItem> |
|||
</TabControl> |
|||
</Window> |
|||
@ -0,0 +1,19 @@ |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog |
|||
{ |
|||
public class MainWindow : Window |
|||
{ |
|||
public MainWindow() |
|||
{ |
|||
this.InitializeComponent(); |
|||
App.AttachDevTools(this); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
<UserControl xmlns="https://github.com/perspex"> |
|||
<StackPanel Orientation="Vertical" Gap="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" |
|||
Gap="16"> |
|||
<Border BorderBrush="#f44336" BorderThickness="2" Padding="16"> |
|||
<TextBlock>Border</TextBlock> |
|||
</Border> |
|||
<Border Background="#f44336" BorderBrush="#4285f4" BorderThickness="4" Padding="16"> |
|||
<TextBlock>Border and Background</TextBlock> |
|||
</Border> |
|||
<Border BorderBrush="#4285f4" |
|||
BorderThickness="4" |
|||
CornerRadius="8" |
|||
Padding="16"> |
|||
<TextBlock>Rounded Corners</TextBlock> |
|||
</Border> |
|||
<Border Background="#f44336" |
|||
CornerRadius="8" |
|||
Padding="16"> |
|||
<TextBlock>Rounded Corners</TextBlock> |
|||
</Border> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,18 @@ |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class BorderPage : UserControl |
|||
{ |
|||
public BorderPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
<UserControl xmlns="https://github.com/perspex"> |
|||
<StackPanel Orientation="Vertical" Gap="4"> |
|||
<TextBlock Classes="h1">Button</TextBlock> |
|||
<TextBlock Classes="h2">A button control</TextBlock> |
|||
|
|||
<StackPanel Orientation="Horizontal" |
|||
Margin="0,16,0,0" |
|||
HorizontalAlignment="Center" |
|||
Gap="16"> |
|||
<StackPanel Orientation="Vertical" Gap="8" Width="150"> |
|||
<Button>Button</Button> |
|||
<Button Foreground="Blue">Foreground</Button> |
|||
<Button Background="#f44336">Background</Button> |
|||
<Button IsEnabled="False">Disabled</Button> |
|||
</StackPanel> |
|||
|
|||
<StackPanel Orientation="Vertical" Gap="8" Width="150"> |
|||
<Button BorderThickness="0">No Border</Button> |
|||
<Button BorderBrush="#f44336">Border Color</Button> |
|||
<Button BorderBrush="#f44336" BorderThickness="4">Thick Border</Button> |
|||
<Button BorderBrush="#f44336" BorderThickness="4" IsEnabled="False">Disabled</Button> |
|||
</StackPanel> |
|||
</StackPanel> |
|||
|
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,18 @@ |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class ButtonPage : UserControl |
|||
{ |
|||
public ButtonPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
<UserControl xmlns="https://github.com/perspex"> |
|||
<StackPanel Orientation="Vertical" Gap="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="200"> |
|||
<Rectangle Fill="Blue" Width="63" Height="41" Canvas.Left="40" Canvas.Top="31"/> |
|||
<Ellipse Fill="Green" Width="58" Height="58" Canvas.Left="160" Canvas.Top="79"/> |
|||
<Path Fill="Red" Data="M50,0 L0,50 100,50 Z" Canvas.Left="50" Canvas.Top="140"/> |
|||
</Canvas> |
|||
|
|||
</StackPanel> |
|||
</UserControl> |
|||
@ -0,0 +1,18 @@ |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class CanvasPage : UserControl |
|||
{ |
|||
public CanvasPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
<UserControl xmlns="https://github.com/perspex"> |
|||
<StackPanel Orientation="Vertical" Gap="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" Gap="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.Transition> |
|||
<PageSlide Duration="0.25"/> |
|||
</Carousel.Transition> |
|||
<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" Gap="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> |
|||
</UserControl> |
|||
@ -0,0 +1,48 @@ |
|||
using System; |
|||
using Perspex.Animation; |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class CarouselPage : UserControl |
|||
{ |
|||
private Carousel _carousel; |
|||
private Button _left; |
|||
private Button _right; |
|||
private DropDown _transition; |
|||
|
|||
public CarouselPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
_left.Click += (s, e) => _carousel.Previous(); |
|||
_right.Click += (s, e) => _carousel.Next(); |
|||
//_transition.SelectionChanged += TransitionChanged;
|
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
_carousel = this.FindControl<Carousel>("carousel"); |
|||
_left = this.FindControl<Button>("left"); |
|||
_right = this.FindControl<Button>("right"); |
|||
_transition = this.FindControl<DropDown>("transition"); |
|||
} |
|||
|
|||
private void TransitionChanged(object sender, SelectionChangedEventArgs e) |
|||
{ |
|||
switch (_transition.SelectedIndex) |
|||
{ |
|||
case 0: |
|||
_carousel.Transition = null; |
|||
break; |
|||
case 1: |
|||
_carousel.Transition = new PageSlide(TimeSpan.FromSeconds(0.25)); |
|||
break; |
|||
case 2: |
|||
_carousel.Transition = new CrossFade(TimeSpan.FromSeconds(0.25)); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<UserControl xmlns="https://github.com/perspex"> |
|||
<StackPanel Orientation="Vertical" Gap="4"> |
|||
<TextBlock Classes="h1">DropDown</TextBlock> |
|||
<TextBlock Classes="h2">A drop-down list.</TextBlock> |
|||
|
|||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 16 0 0" Gap="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="Red"/> |
|||
<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> |
|||
@ -0,0 +1,18 @@ |
|||
using Perspex.Controls; |
|||
using Perspex.Markup.Xaml; |
|||
|
|||
namespace ControlCatalog.Pages |
|||
{ |
|||
public class DropDownPage : UserControl |
|||
{ |
|||
public DropDownPage() |
|||
{ |
|||
this.InitializeComponent(); |
|||
} |
|||
|
|||
private void InitializeComponent() |
|||
{ |
|||
PerspexXamlLoader.Load(this); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
using System.Reflection; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
// General Information about an assembly is controlled through the following
|
|||
// set of attributes. Change these attribute values to modify the information
|
|||
// associated with an assembly.
|
|||
[assembly: AssemblyTitle("ControlCatalog")] |
|||
[assembly: AssemblyDescription("")] |
|||
[assembly: AssemblyConfiguration("")] |
|||
[assembly: AssemblyCompany("")] |
|||
[assembly: AssemblyProduct("ControlCatalog")] |
|||
[assembly: AssemblyCopyright("Copyright © 2015")] |
|||
[assembly: AssemblyTrademark("")] |
|||
[assembly: AssemblyCulture("")] |
|||
|
|||
// Setting ComVisible to false makes the types in this assembly not visible
|
|||
// to COM components. If you need to access a type in this assembly from
|
|||
// COM, set the ComVisible attribute to true on that type.
|
|||
[assembly: ComVisible(false)] |
|||
|
|||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|||
[assembly: Guid("61bec86c-f307-4295-b5b8-9428610d7d55")] |
|||
|
|||
// Version information for an assembly consists of the following four values:
|
|||
//
|
|||
// Major Version
|
|||
// Minor Version
|
|||
// Build Number
|
|||
// Revision
|
|||
//
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
|||
// by using the '*' as shown below:
|
|||
// [assembly: AssemblyVersion("1.0.*")]
|
|||
[assembly: AssemblyVersion("1.0.0.0")] |
|||
[assembly: AssemblyFileVersion("1.0.0.0")] |
|||
@ -0,0 +1,40 @@ |
|||
<Styles xmlns="https://github.com/perspex"> |
|||
<Style Selector="TabControl.sidebar"> |
|||
<Setter Property="Template"> |
|||
<ControlTemplate> |
|||
<DockPanel> |
|||
<Border MinWidth="190" Background="#1976D2" DockPanel.Dock="Left"> |
|||
<TabStrip Name="PART_TabStrip" |
|||
MemberSelector="{Static TabControl.HeaderSelector}" |
|||
Items="{TemplateBinding Items}" |
|||
SelectedIndex="{TemplateBinding Path=SelectedIndex, Mode=TwoWay}"> |
|||
<TabStrip.ItemsPanel> |
|||
<ItemsPanelTemplate> |
|||
<StackPanel Orientation="Vertical"/> |
|||
</ItemsPanelTemplate> |
|||
</TabStrip.ItemsPanel> |
|||
</TabStrip> |
|||
</Border> |
|||
<Carousel Name="PART_Content" |
|||
Margin="8 0 0 0" |
|||
MemberSelector="{Static TabControl.ContentSelector}" |
|||
Items="{TemplateBinding Items}" |
|||
SelectedIndex="{TemplateBinding Path=SelectedIndex}" |
|||
Transition="{TemplateBinding Transition}" |
|||
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"/> |
|||
</Style> |
|||
|
|||
<Style Selector="TabControl.sidebar TabStripItem:selected"> |
|||
<Setter Property="Background" Value="#20ffffff"/> |
|||
</Style> |
|||
</Styles> |
|||
@ -0,0 +1,84 @@ |
|||
using System; |
|||
using Perspex; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Primitives; |
|||
using Perspex.Media; |
|||
|
|||
namespace XamlTestApplication |
|||
{ |
|||
public class TestScrollable : Control, IScrollable |
|||
{ |
|||
private int itemCount = 100; |
|||
private Size _extent; |
|||
private Vector _offset; |
|||
private Size _viewport; |
|||
private Size _lineSize; |
|||
|
|||
public Action InvalidateScroll { get; set; } |
|||
|
|||
Size IScrollable.Extent |
|||
{ |
|||
get { return _extent; } |
|||
} |
|||
|
|||
Vector IScrollable.Offset |
|||
{ |
|||
get { return _offset; } |
|||
|
|||
set |
|||
{ |
|||
_offset = value; |
|||
InvalidateVisual(); |
|||
} |
|||
} |
|||
|
|||
Size IScrollable.Viewport |
|||
{ |
|||
get { return _viewport; } |
|||
} |
|||
|
|||
protected override Size MeasureOverride(Size availableSize) |
|||
{ |
|||
using (var line = new FormattedText( |
|||
"Item 100", |
|||
TextBlock.GetFontFamily(this), |
|||
TextBlock.GetFontSize(this), |
|||
TextBlock.GetFontStyle(this), |
|||
TextAlignment.Left, |
|||
TextBlock.GetFontWeight(this))) |
|||
{ |
|||
line.Constraint = availableSize; |
|||
_lineSize = line.Measure(); |
|||
return new Size(_lineSize.Width, _lineSize.Height * itemCount); |
|||
} |
|||
} |
|||
|
|||
protected override Size ArrangeOverride(Size finalSize) |
|||
{ |
|||
_viewport = new Size(finalSize.Width, finalSize.Height / _lineSize.Height); |
|||
_extent = new Size(_lineSize.Width, itemCount + 1); |
|||
InvalidateScroll?.Invoke(); |
|||
return finalSize; |
|||
} |
|||
|
|||
public override void Render(DrawingContext context) |
|||
{ |
|||
var y = 0.0; |
|||
|
|||
for (var i = (int)_offset.Y; i < itemCount; ++i) |
|||
{ |
|||
using (var line = new FormattedText( |
|||
"Item " + (i + 1), |
|||
TextBlock.GetFontFamily(this), |
|||
TextBlock.GetFontSize(this), |
|||
TextBlock.GetFontStyle(this), |
|||
TextAlignment.Left, |
|||
TextBlock.GetFontWeight(this))) |
|||
{ |
|||
context.DrawText(Brushes.Black, new Point(-_offset.X, y), line); |
|||
y += _lineSize.Height; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,4 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<packages> |
|||
<package id="Rx-Core" version="2.2.5" targetFramework="portable45-net45+win8" /> |
|||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="portable45-net45+win8" /> |
|||
<package id="Rx-Linq" version="2.2.5" targetFramework="portable45-net45+win8" /> |
|||
<package id="Rx-Main" version="2.2.5" targetFramework="portable45-net45+win8" /> |
|||
<package id="Rx-PlatformServices" version="2.2.5" targetFramework="portable45-net45+win8" /> |
|||
<package id="Splat" version="1.6.2" targetFramework="portable45-net45+win8" /> |
|||
</packages> |
|||
@ -0,0 +1,36 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using System.Globalization; |
|||
using OmniXaml.TypeConversion; |
|||
using Perspex.Input; |
|||
using Perspex.Media.Imaging; |
|||
using Perspex.Platform; |
|||
|
|||
namespace Perspex.Markup.Xaml.Converters |
|||
{ |
|||
public class CursorTypeConverter : ITypeConverter |
|||
{ |
|||
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType) |
|||
{ |
|||
return sourceType == typeof(string); |
|||
} |
|||
|
|||
public bool CanConvertTo(IXamlTypeConverterContext context, Type destinationType) |
|||
{ |
|||
return false; |
|||
} |
|||
|
|||
public object ConvertFrom(IXamlTypeConverterContext context, CultureInfo culture, object value) |
|||
{ |
|||
var cursor = (StandardCursorType)Enum.Parse(typeof (StandardCursorType), ((string) value).Trim(), true); |
|||
return new Cursor(cursor); |
|||
} |
|||
|
|||
public object ConvertTo(IXamlTypeConverterContext context, CultureInfo culture, object value, Type destinationType) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,35 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using System.Reactive.Subjects; |
|||
|
|||
namespace Perspex.Markup.Xaml.Data |
|||
{ |
|||
/// <summary>
|
|||
/// Defines a binding that can be created in XAML markup.
|
|||
/// </summary>
|
|||
public interface IXamlBinding |
|||
{ |
|||
/// <summary>
|
|||
/// Applies the binding to a property on an instance.
|
|||
/// </summary>
|
|||
/// <param name="instance">The target instance.</param>
|
|||
/// <param name="property">The target property.</param>
|
|||
void Bind(IObservablePropertyBag instance, PerspexProperty property); |
|||
|
|||
/// <summary>
|
|||
/// Creates a subject that can be used to get and set the value of the binding.
|
|||
/// </summary>
|
|||
/// <param name="target">The target instance.</param>
|
|||
/// <param name="targetType">The type of the target property.</param>
|
|||
/// <param name="targetIsDataContext">
|
|||
/// Whether the target property is the DataContext property.
|
|||
/// </param>
|
|||
/// <returns>An <see cref="ISubject{object}"/>.</returns>
|
|||
ISubject<object> CreateSubject( |
|||
IObservablePropertyBag target, |
|||
Type targetType, |
|||
bool targetIsDataContext = false); |
|||
} |
|||
} |
|||
@ -1 +1 @@ |
|||
Subproject commit 3e3b46ba66941da925092e2977003d0553cfc907 |
|||
Subproject commit 0904dcb07175ca0cdf2ae1fda1434c0f1425a53e |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue