Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 40 additions & 32 deletions Microsoft.Toolkit.Sample.Forms.App/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 44 additions & 7 deletions Microsoft.Toolkit.Sample.Forms.App/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

using Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Microsoft.Toolkit.Win32.Samples.WinForms.App
Expand All @@ -25,6 +18,50 @@ public Form1()
private void Form1_Load(object sender, EventArgs e)
{
inkCanvas1.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Pen | CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Touch;

var stackPanel = new Windows.UI.Xaml.Controls.StackPanel()
{
Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black),
};

stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle()
{
Width = 50,
Height = 75,
Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Blue),
});

stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle()
{
Width = 200,
Height = 30,
Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red),
});

stackPanel.Children.Add(new Windows.UI.Xaml.Controls.Button()
{
Width = 160,
Height = 60,
HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
Content = "This is a UWP Button",
});

stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle()
{
Width = 25,
Height = 100,
Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Green),
});

stackPanel.Children.Add(new Windows.UI.Xaml.Controls.Button()
{
Width = 300,
Height = 40,
HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
Content = "Another long UWP Button",
});

windowsXamlHost.Child = stackPanel;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.WindowsRuntime">
<HintPath>$(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider" />
Expand Down
10 changes: 2 additions & 8 deletions Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:xamlhost="clr-namespace:Microsoft.Toolkit.Sample.Wpf.XamlHost;assembly=Microsoft.Toolkit.Sample.Wpf.XamlHost"
xmlns:xamlhost="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
xmlns:controls="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls"
xmlns:controls1="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls.WebView"
mc:Ignorable="d"
Expand All @@ -22,13 +22,7 @@
</TabItem>
<TabItem>
<TabItem.Header>Samples</TabItem.Header>
<StackPanel Background="Azure">
<xamlhost:WrappedRectangle Width="50" Height="75" Fill="Blue"/>
<xamlhost:WrappedRectangle Width="200" Height="100" Fill="Red"/>
<xamlhost:WrappedButton Content="This is a UWP Button" Height="60" Width="160"/>
<xamlhost:WrappedRectangle Width="25" Height="100" Fill="Green"/>
<xamlhost:WrappedButton Content="Another long UWP Button" Height="40" Width="300"/>
</StackPanel>
<xamlhost:WindowsXamlHost x:Name="windowsXamlHost" Loaded="WindowsXamlHost_Loaded" />
</TabItem>
<TabItem>
<TabItem.Header>MediaPlayerElement</TabItem.Header>
Expand Down
50 changes: 48 additions & 2 deletions Microsoft.Toolkit.Sample.Wpf.App/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ private void inkCanvas_Loaded(object sender, RoutedEventArgs e)

private void inkToolbar_Initialized(object sender, EventArgs e)
{
// Handle ink toolbar initialization events here

// Handle ink toolbar initialization events here
}

private void inkToolbar_ActiveToolChanged(object sender, object e)
Expand All @@ -43,6 +42,53 @@ private async void myMap_Loaded(object sender, RoutedEventArgs e)
// Set the map location.
await myMap.TrySetViewAsync(cityCenter, 12);
}

private void WindowsXamlHost_Loaded(object sender, RoutedEventArgs e)
{
var stackPanel = new Windows.UI.Xaml.Controls.StackPanel()
{
Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black),
};

stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle()
{
Width = 50,
Height = 75,
Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Blue),
});

stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle()
{
Width = 200,
Height = 30,
Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red),
});

stackPanel.Children.Add(new Windows.UI.Xaml.Controls.Button()
{
Width = 160,
Height = 60,
HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
Content = "This is a UWP Button",
});

stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle()
{
Width = 25,
Height = 100,
Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Green),
});

stackPanel.Children.Add(new Windows.UI.Xaml.Controls.Button()
{
Width = 300,
Height = 40,
HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
Content = "Another long UWP Button",
});

windowsXamlHost.Child = stackPanel;
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.WindowsRuntime">
<HintPath>$(WINDIR)\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand All @@ -34,7 +37,6 @@
<ItemGroup>
<ProjectReference Include="..\Microsoft.Toolkit.Wpf.UI.Controls.WebView\Microsoft.Toolkit.Wpf.UI.Controls.WebView.csproj" />
<ProjectReference Include="..\Microsoft.Toolkit.Wpf.UI.Controls\Microsoft.Toolkit.Wpf.UI.Controls.csproj" />
<ProjectReference Include="..\Microsoft.Toolkit.Sample.Wpf.XamlHost\Microsoft.Toolkit.Sample.Wpf.XamlHost.csproj" />
<ProjectReference Include="..\Microsoft.Toolkit.Wpf.UI.XamlHost\Microsoft.Toolkit.Wpf.UI.XamlHost.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
Loading