Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Surface Dial Textbox Helper class. #704

Merged
merged 5 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
<Content Include="SamplePages\Scale\ScaleBehavior.png" />
<Content Include="SamplePages\SlidableListItem\SlidableListItem.png" />
<Content Include="SamplePages\Object Storage\ObjectStorage.png" />
<Content Include="SamplePages\SurfaceDialTextboxHelper\SurfaceDialTextboxHelper.png" />
<Content Include="SamplePages\TextBoxMask\TextBoxMask.png" />
<Content Include="SamplePages\Toast\icon.jpg" />
<Content Include="SamplePages\Twitter Service\TwitterCode.bind" />
Expand Down Expand Up @@ -328,6 +329,9 @@
<Content Include="SamplePages\SystemInformation\SystemInformationCode.bind" />
<Content Include="SamplePages\DispatcherHelper\DispatcherHelperCode.bind" />
<Content Include="SamplePages\TextBoxMask\TextBoxMask.bind" />
<Content Include="SamplePages\SurfaceDialTextboxHelper\SurfaceDialTextboxHelperCode.bind">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
Expand Down Expand Up @@ -419,6 +423,9 @@
<Compile Include="SamplePages\Object Storage\ObjectStoragePage.xaml.cs">
<DependentUpon>ObjectStoragePage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\SurfaceDialTextboxHelper\SurfaceDialTextboxHelperPage.xaml.cs">
<DependentUpon>SurfaceDialTextboxHelperPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\SystemInformation\SystemInformationPage.xaml.cs">
<DependentUpon>SystemInformationPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -594,6 +601,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\SurfaceDialTextboxHelper\SurfaceDialTextboxHelperPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\SystemInformation\SystemInformationPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.SurfaceDialTextboxHelperPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid x:Name="Root"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center">

<TextBox HorizontalAlignment="Left"
VerticalAlignment="Top"
Text="0"
Width="106"
controls:SurfaceDialTextboxHelper.StepValue="@[StepValue:DoubleSlider:1:0.1-10]"
controls:SurfaceDialTextboxHelper.ForceMenuItem="@[ForceMenuItem:Bool:true]"
controls:SurfaceDialTextboxHelper.EnableHapticFeedback="@[EnableHapticFeedback:Bool:true]"
controls:SurfaceDialTextboxHelper.EnableMinMaxValue="@[EnableMinMaxValue:Bool:true]"
controls:SurfaceDialTextboxHelper.MinValue="@[MinValue:DoubleSlider:0:0-100]"
controls:SurfaceDialTextboxHelper.MaxValue="@[MaxValue:DoubleSlider:100:0-100]"
controls:SurfaceDialTextboxHelper.Icon="@[Icon:Enum:RadialControllerMenuKnownIcon.Ruler]"
controls:SurfaceDialTextboxHelper.EnableTapToNextControl="@[EnableTapToNextControl:Bool:true]"/>
</StackPanel>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.SurfaceDialTextboxHelperPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid x:Name="Root"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center">

<TextBox Width="106"
HorizontalAlignment="Left"
VerticalAlignment="Top"
controls:SurfaceDialTextboxHelper.EnableHapticFeedback="{Binding DataContext.EnableHapticFeedback.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.EnableMinMaxValue="{Binding DataContext.EnableMinMaxValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.EnableTapToNextControl="{Binding DataContext.EnableTapToNextControl.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.ForceMenuItem="{Binding DataContext.ForceMenuItem.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.Icon="{Binding DataContext.Icon.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.MaxValue="{Binding DataContext.MaxValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.MinValue="{Binding DataContext.MinValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.StepValue="{Binding DataContext.StepValue.Value, ElementName=Root, Mode=OneWay}"
Text="0" />

<TextBox Width="106"
HorizontalAlignment="Left"
VerticalAlignment="Top"
controls:SurfaceDialTextboxHelper.EnableHapticFeedback="{Binding DataContext.EnableHapticFeedback.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.EnableMinMaxValue="{Binding DataContext.EnableMinMaxValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.EnableTapToNextControl="{Binding DataContext.EnableTapToNextControl.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.ForceMenuItem="{Binding DataContext.ForceMenuItem.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.Icon="{Binding DataContext.Icon.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.MaxValue="{Binding DataContext.MaxValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.MinValue="{Binding DataContext.MinValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.StepValue="{Binding DataContext.StepValue.Value, ElementName=Root, Mode=OneWay}"
Text="0" />

<TextBox Width="106"
HorizontalAlignment="Left"
VerticalAlignment="Top"
controls:SurfaceDialTextboxHelper.EnableHapticFeedback="{Binding DataContext.EnableHapticFeedback.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.EnableMinMaxValue="{Binding DataContext.EnableMinMaxValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.EnableTapToNextControl="{Binding DataContext.EnableTapToNextControl.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.ForceMenuItem="{Binding DataContext.ForceMenuItem.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.Icon="{Binding DataContext.Icon.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.MaxValue="{Binding DataContext.MaxValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.MinValue="{Binding DataContext.MinValue.Value, ElementName=Root, Mode=OneWay}"
controls:SurfaceDialTextboxHelper.StepValue="{Binding DataContext.StepValue.Value, ElementName=Root, Mode=OneWay}"
Text="0" />
</StackPanel>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using Microsoft.Toolkit.Uwp.SampleApp.Models;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SurfaceDialTextboxHelperPage : Page
{
public SurfaceDialTextboxHelperPage()
{
InitializeComponent();
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);

var propertyDesc = e.Parameter as PropertyDescriptor;

if (propertyDesc != null)
{
DataContext = propertyDesc.Expando;
}
}
}
}
8 changes: 8 additions & 0 deletions Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
"CodeUrl": "https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TextBoxMask",
"XamlCodeFile": "TextBoxMask.bind",
"Icon": "/SamplePages/TextBoxMask/TextBoxMask.png"
},
{
"Name": "SurfaceDialTextboxHelper",
"Type": "SurfaceDialTextboxHelperPage",
"About": "Enables support for Surface Dial on any given Textbox. Rotate the Dial to change the numeric value of the Textbox.",
"CodeUrl": "https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/SurfaceDialTextboxHelper",
"XamlCodeFile": "SurfaceDialTextboxHelperCode.bind",
"Icon": "/SamplePages/SurfaceDialTextboxHelper/SurfaceDialTextboxHelper.png"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<Compile Include="MasterDetailsView\MasterDetailsViewState.cs" />
<Compile Include="SlidableListItem\SwipeStatus.cs" />
<Compile Include="SlidableListItem\SwipeStatusChangedEventArgs.cs" />
<Compile Include="SurfaceDialTextboxHelper\SurfaceDialTextboxHelper.cs" />
<Compile Include="TextBoxMask\TextBoxMask.cs" />
<Compile Include="TextBoxMask\TextBoxMask.Properties.cs" />
<None Include="Microsoft.Toolkit.Uwp.UI.Controls.ruleset" />
Expand Down
Loading