This commit is contained in:
David Catuhe 2017-01-25 13:59:56 -08:00
Родитель 38b5cfd7ba
Коммит 3bbe6832b4
14 изменённых файлов: 93 добавлений и 93 удалений

Просмотреть файл

@ -257,8 +257,8 @@
<Content Include="SamplePages\Microsoft Graph Service\OfficeLogo.png" />
<Content Include="SamplePages\Microsoft Graph Service\user.png" />
<Content Include="SamplePages\Microsoft Translator Service\TranslatorService.png" />
<Content Include="SamplePages\MosaicControl\Animations.png" />
<Content Include="SamplePages\MosaicControl\MosaicControl.png" />
<Content Include="SamplePages\TileControl\Animations.png" />
<Content Include="SamplePages\TileControl\TileControl.png" />
<Content Include="SamplePages\Offset\OffsetBehavior.png" />
<Content Include="SamplePages\PrintHelper\PrintHelper.png" />
<Content Include="SamplePages\PullToRefreshListView\PullToRefreshListView.png" />
@ -345,7 +345,7 @@
<Content Include="SamplePages\Light\LightBehaviorCode.bind" />
<Content Include="SamplePages\Light\LightBehaviorXaml.bind" />
<Content Include="SamplePages\TextBoxMask\TextBoxMask.bind" />
<Content Include="SamplePages\MosaicControl\MosaicControl.bind">
<Content Include="SamplePages\TileControl\TileControl.bind">
<SubType>Designer</SubType>
</Content>
<Content Include="SamplePages\SurfaceDialTextboxHelper\SurfaceDialTextboxHelperCode.bind">
@ -415,8 +415,8 @@
<Compile Include="SamplePages\Microsoft Translator Service\MicrosoftTranslatorPage.xaml.cs">
<DependentUpon>MicrosoftTranslatorPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\MosaicControl\MosaicControlPage.xaml.cs">
<DependentUpon>MosaicControlPage.xaml</DependentUpon>
<Compile Include="SamplePages\TileControl\TileControlPage.xaml.cs">
<DependentUpon>TileControlPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\ScrollHeader\ScrollHeaderPage.xaml.cs">
<DependentUpon>ScrollHeaderPage.xaml</DependentUpon>
@ -605,7 +605,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SamplePages\MosaicControl\MosaicControlPage.xaml">
<Page Include="SamplePages\TileControl\TileControlPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 328 B

После

Ширина:  |  Высота:  |  Размер: 328 B

Просмотреть файл

@ -30,8 +30,8 @@
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<controls:MosaicControl
ImageSource ="ms-appx:///SamplePages/MosaicControl/Animations.png"
<controls:TileControl
ImageSource ="ms-appx:///SamplePages/TileControl/Animations.png"
OffsetX ="@[OffsetX:Slider:0:0-150]"
OffsetY ="@[OffsetY:Slider:0:0-150]"
@ -51,9 +51,9 @@
<Border Style="{StaticResource BorderStyle}">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="Simple Content"></TextBlock>
</Border>
</controls:MosaicControl>
</controls:TileControl>
<controls:MosaicControl Grid.Row="2" Background="{StaticResource Brush-Grey-04}" ImageSource="ms-appx:///SamplePages/MosaicControl/Animations.png" ScrollViewerContainer="{x:Bind FlipView, Mode=OneTime}">
<controls:TileControl Grid.Row="2" Background="{StaticResource Brush-Grey-04}" ImageSource="ms-appx:///SamplePages/TileControl/Animations.png" ScrollViewerContainer="{x:Bind FlipView, Mode=OneTime}">
<FlipView x:Name="FlipView">
<Border Style="{StaticResource BorderStyle}">
@ -65,7 +65,7 @@
</Border>
</FlipView>
</controls:MosaicControl>
</controls:TileControl>
</Grid>
</Page>

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 29 KiB

После

Ширина:  |  Высота:  |  Размер: 29 KiB

Просмотреть файл

@ -1,4 +1,4 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.MosaicControlPage"
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.TileControlPage"
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"
@ -36,7 +36,7 @@
HorizontalAlignment="Center"
FontSize="20"
Text="MosaicControl can be used to highlight computer activity:" />
<controls:MosaicControl Grid.Row="1"
<controls:TileControl Grid.Row="1"
AnimationDuration="{Binding AnimationDuration.Value, Mode=OneWay}"
AnimationStepX="{Binding AnimationStepX.Value, Mode=OneWay}"
AnimationStepY="{Binding AnimationStepY.Value, Mode=OneWay}"
@ -51,14 +51,14 @@
<TextBlock Style="{StaticResource TextBlockStyle}"
Text="Processing, please wait..." />
</Border>
</controls:MosaicControl>
</controls:TileControl>
<TextBlock Grid.Row="2"
Margin="10,20"
HorizontalAlignment="Center"
FontSize="20"
Text="It can also be used for background painting:" />
<controls:MosaicControl Grid.Row="3"
<controls:TileControl Grid.Row="3"
Background="{StaticResource Brush-Grey-04}"
ImageSource="ms-appx:///SamplePages/MosaicControl/Animations.png"
ParallaxSpeedRatio="{Binding ParallaxSpeedRatio.Value, Mode=OneWay}"
@ -76,7 +76,7 @@
</Border>
</FlipView>
</controls:MosaicControl>
</controls:TileControl>
</Grid>
</Page>
</Page>

Просмотреть файл

@ -15,9 +15,9 @@ using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
public sealed partial class MosaicControlPage
public sealed partial class TileControlPage
{
public MosaicControlPage()
public TileControlPage()
{
InitializeComponent();
}

Просмотреть файл

@ -134,12 +134,12 @@
"Icon": "/SamplePages/TextBoxMask/TextBoxMask.png"
},
{
"Name": "MosaicControl",
"Type": "MosaicControlPage",
"Name": "TileControl",
"Type": "TileControlPage",
"About": "A ContentControl that show an image repeated many times.The control can be synchronized with a Scrollviewer and animated easily",
"CodeUrl": "https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MosaicControl",
"XamlCodeFile": "MosaicControl.bind",
"Icon": "/SamplePages/MosaicControl/MosaicControl.png"
"CodeUrl": "https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl",
"XamlCodeFile": "TileControl.bind",
"Icon": "/SamplePages/TileControl/TileControl.png"
},
{
"Name": "SurfaceDialTextboxHelper",

Просмотреть файл

@ -73,7 +73,6 @@
<Compile Include="MasterDetailsView\MasterDetailsView.Properties.cs" />
<Compile Include="BladeView\BladeItem.Events.cs" />
<Compile Include="MasterDetailsView\MasterDetailsViewState.cs" />
<Compile Include="MosaicControl\MosaicControl.cs" />
<Compile Include="SlidableListItem\SwipeStatus.cs" />
<Compile Include="SlidableListItem\SwipeStatusChangedEventArgs.cs" />
<Compile Include="SurfaceDialTextboxHelper\SurfaceDialTextboxHelper.cs" />
@ -82,6 +81,7 @@
<Compile Include="TextBoxRegex\TextBoxRegex.Data.cs" />
<Compile Include="TextBoxRegex\TextBoxRegex.Properties.cs" />
<Compile Include="TextBoxRegex\TextBoxRegex.cs" />
<Compile Include="TileControl\TileControl.cs" />
<Compile Include="WrapPanel\WrapPanel.cs" />
<Compile Include="WrapPanel\WrapPanel.Data.cs" />
<None Include="Microsoft.Toolkit.Uwp.UI.Controls.ruleset" />
@ -146,7 +146,7 @@
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="MosaicControl\MosaicControl.xaml">
<Page Include="TileControl\TileControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>

Просмотреть файл

@ -14,7 +14,7 @@
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/MasterDetailsView/MasterDetailsView.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/Loading/Loading.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/MosaicControl/MosaicControl.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/TileControl/TileControl.xaml" />
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls/DropShadowPanel/DropShadowPanel.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Просмотреть файл

@ -88,73 +88,73 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// A ContentControl that show an image repeated many times.
/// The control can be synchronized with a Scrollviewer and animated easily.
/// </summary>
public sealed class MosaicControl : ContentControl
public sealed class TileControl : ContentControl
{
/// <summary>
/// Identifies the <see cref="ScrollViewerContainer"/> property.
/// </summary>
public static readonly DependencyProperty ScrollViewerContainerProperty =
DependencyProperty.Register(nameof(ScrollViewerContainer), typeof(FrameworkElement), typeof(MosaicControl), new PropertyMetadata(null, OnScrollViewerContainerChange));
DependencyProperty.Register(nameof(ScrollViewerContainer), typeof(FrameworkElement), typeof(TileControl), new PropertyMetadata(null, OnScrollViewerContainerChange));
/// <summary>
/// Identifies the <see cref="ImageAlignment"/> property.
/// </summary>
public static readonly DependencyProperty ImageAlignmentProperty =
DependencyProperty.Register(nameof(ImageAlignment), typeof(ImageAlignment), typeof(MosaicControl), new PropertyMetadata(ImageAlignment.None, OnAlignmentChange));
DependencyProperty.Register(nameof(ImageAlignment), typeof(ImageAlignment), typeof(TileControl), new PropertyMetadata(ImageAlignment.None, OnAlignmentChange));
/// <summary>
/// Identifies the <see cref="ImageSource"/> property.
/// </summary>
public static readonly DependencyProperty ImageSourceProperty =
DependencyProperty.Register(nameof(ImageSource), typeof(Uri), typeof(MosaicControl), new PropertyMetadata(null, OnImageSourceChanged));
DependencyProperty.Register(nameof(ImageSource), typeof(Uri), typeof(TileControl), new PropertyMetadata(null, OnImageSourceChanged));
/// <summary>
/// Identifies the <see cref="ScrollOrientation"/> property.
/// </summary>
public static readonly DependencyProperty ScrollOrientationProperty =
DependencyProperty.Register(nameof(ScrollOrientation), typeof(ScrollOrientation), typeof(MosaicControl), new PropertyMetadata(ScrollOrientation.Both, OnOrientationChanged));
DependencyProperty.Register(nameof(ScrollOrientation), typeof(ScrollOrientation), typeof(TileControl), new PropertyMetadata(ScrollOrientation.Both, OnOrientationChanged));
/// <summary>
/// Identifies the <see cref="OffsetX"/> property.
/// </summary>
public static readonly DependencyProperty OffsetXProperty =
DependencyProperty.Register(nameof(OffsetX), typeof(double), typeof(MosaicControl), new PropertyMetadata(0.0, OnOffsetChange));
DependencyProperty.Register(nameof(OffsetX), typeof(double), typeof(TileControl), new PropertyMetadata(0.0, OnOffsetChange));
/// <summary>
/// Identifies the <see cref="OffsetY"/> property.
/// </summary>
public static readonly DependencyProperty OffsetYProperty =
DependencyProperty.Register(nameof(OffsetY), typeof(double), typeof(MosaicControl), new PropertyMetadata(0.0, OnOffsetChange));
DependencyProperty.Register(nameof(OffsetY), typeof(double), typeof(TileControl), new PropertyMetadata(0.0, OnOffsetChange));
/// <summary>
/// Identifies the <see cref="ParallaxSpeedRatio"/> property.
/// </summary>
public static readonly DependencyProperty ParallaxSpeedRatioProperty =
DependencyProperty.Register(nameof(ParallaxSpeedRatio), typeof(double), typeof(MosaicControl), new PropertyMetadata(1.0, OnScrollSpeedRatioChange));
DependencyProperty.Register(nameof(ParallaxSpeedRatio), typeof(double), typeof(TileControl), new PropertyMetadata(1.0, OnScrollSpeedRatioChange));
/// <summary>
/// Identifies the <see cref="IsAnimated"/> property.
/// </summary>
public static readonly DependencyProperty IsAnimatedProperty =
DependencyProperty.Register(nameof(IsAnimated), typeof(bool), typeof(MosaicControl), new PropertyMetadata(false, OnIsAnimatedChange));
DependencyProperty.Register(nameof(IsAnimated), typeof(bool), typeof(TileControl), new PropertyMetadata(false, OnIsAnimatedChange));
/// <summary>
/// Identifies the <see cref="AnimationStepX"/> property.
/// </summary>
public static readonly DependencyProperty AnimationStepXProperty =
DependencyProperty.Register(nameof(AnimationStepX), typeof(double), typeof(MosaicControl), new PropertyMetadata(1.0));
DependencyProperty.Register(nameof(AnimationStepX), typeof(double), typeof(TileControl), new PropertyMetadata(1.0));
/// <summary>
/// Identifies the <see cref="AnimationStepY"/> property.
/// </summary>
public static readonly DependencyProperty AnimationStepYProperty =
DependencyProperty.Register(nameof(AnimationStepY), typeof(double), typeof(MosaicControl), new PropertyMetadata(1.0));
DependencyProperty.Register(nameof(AnimationStepY), typeof(double), typeof(TileControl), new PropertyMetadata(1.0));
/// <summary>
/// Identifies the <see cref="AnimationDuration"/> property.
/// </summary>
public static readonly DependencyProperty AnimationDurationProperty =
DependencyProperty.Register(nameof(AnimationDuration), typeof(double), typeof(MosaicControl), new PropertyMetadata(30.0, OnAnimationDuration));
DependencyProperty.Register(nameof(AnimationDuration), typeof(double), typeof(TileControl), new PropertyMetadata(30.0, OnAnimationDuration));
private FrameworkElement _rootElement = null;
private Canvas _containerElement = null;
@ -172,7 +172,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private DispatcherTimer _timerAnimation = null;
/// <summary>
/// A Scrollviewer used for synchronized the move of the <see cref="MosaicControl"/>
/// A Scrollviewer used for synchronized the move of the <see cref="TileControl"/>
/// </summary>
private ScrollViewer _scrollviewer = null;
@ -221,11 +221,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3); // SDK >= 14393
/// <summary>
/// Initializes a new instance of the <see cref="MosaicControl"/> class.
/// Initializes a new instance of the <see cref="TileControl"/> class.
/// </summary>
public MosaicControl()
public TileControl()
{
DefaultStyleKey = typeof(MosaicControl);
DefaultStyleKey = typeof(TileControl);
InitializeAnimation();
}
@ -242,7 +242,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static async void OnScrollViewerContainerChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as MosaicControl;
var control = d as TileControl;
await control.InitializeScrollViewerContainer(e.OldValue as FrameworkElement, e.NewValue as FrameworkElement);
}
@ -281,7 +281,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
}
/// <summary>
/// Gets how the <see cref="MosaicControl"/> is rendered
/// Gets how the <see cref="TileControl"/> is rendered
/// The default value is Composition.
/// </summary>
private UIStrategy Strategy
@ -316,7 +316,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static async void OnAlignmentChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as MosaicControl;
var control = d as TileControl;
await control.RefreshContainerMosaicLocked();
}
@ -376,7 +376,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static async void OnImageSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as MosaicControl;
var control = d as TileControl;
await control.LoadImageBrush(e.NewValue as Uri);
}
@ -503,7 +503,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static async void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as MosaicControl;
var control = d as TileControl;
await control.RefreshContainerMosaicLocked();
await control.CreateModuloExpression(control._scrollviewer);
}
@ -772,7 +772,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnOffsetChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var c = d as MosaicControl;
var c = d as TileControl;
c.RefreshMove();
}
@ -797,7 +797,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnScrollSpeedRatioChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var c = d as MosaicControl;
var c = d as TileControl;
c.RefreshScrollSpeedRatio((double)e.NewValue);
}
@ -1037,7 +1037,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnIsAnimatedChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var c = d as MosaicControl;
var c = d as TileControl;
if ((bool)e.NewValue == true)
{
@ -1125,7 +1125,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnAnimationDuration(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var c = d as MosaicControl;
var c = d as TileControl;
c._timerAnimation.Interval = TimeSpan.FromMilliseconds(c.AnimationDuration);
}

Просмотреть файл

@ -1,11 +1,11 @@
<ResourceDictionary 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">
<Style TargetType="controls:MosaicControl">
<Style TargetType="controls:TileControl">
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:MosaicControl">
<ControlTemplate TargetType="controls:TileControl">
<Grid>
<Border x:Name="RootElement"
Background="{TemplateBinding Background}"

Просмотреть файл

@ -1,39 +0,0 @@
# MosaicControl XAML Control
The **Mosaic Control** is a control that repeat an image many times. It enables you to use animation and synchronization with a ScrollViewer to create parallax effect. XAML or Microsoft Composition are automatically used to render the control.
## Syntax
```xaml
<controls:MosaicControl x:Name="Mosaic1"
OffsetX="-10"
OffsetY="10"
IsAnimated="True"
ScrollViewerContainer="{x:Bind FlipView}"
ParallaxSpeedRatio="1.2"
/>
```
## Example Image
![MosaicControl animation](../resources/images/MosaicControl.gif "MosaicControl")
## Example Code
[MosaicControl Sample Page](https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/MosaicControl)
## Default Template
[MosaicControl XAML File](https://github.com/Microsoft/UWPCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls/MosaicControl/MosaicControl.xaml) is the XAML template used in the toolkit for the default styling.
## Requirements (Windows 10 Device Family)
| [Device family](http://go.microsoft.com/fwlink/p/?LinkID=526370) | Universal, 10.0.10586.0 or higher |
| --- | --- |
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls |
## API
* [MosaicControl source code](https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/MosaicControl)

Просмотреть файл

@ -0,0 +1,39 @@
# TileControl XAML Control
The **Tile Control** is a control that repeat an image many times. It enables you to use animation and synchronization with a ScrollViewer to create parallax effect. XAML or Microsoft Composition are automatically used to render the control.
## Syntax
```xaml
<controls:TileControl x:Name="Tile1"
OffsetX="-10"
OffsetY="10"
IsAnimated="True"
ScrollViewerContainer="{x:Bind FlipView}"
ParallaxSpeedRatio="1.2"
/>
```
## Example Image
![TileControl animation](../resources/images/TileControl.gif "TileControl")
## Example Code
[TileControl Sample Page](https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TileControl)
## Default Template
[TileControl XAML File](https://github.com/Microsoft/UWPCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl/TileControl.xaml) is the XAML template used in the toolkit for the default styling.
## Requirements (Windows 10 Device Family)
| [Device family](http://go.microsoft.com/fwlink/p/?LinkID=526370) | Universal, 10.0.10586.0 or higher |
| --- | --- |
| Namespace | Microsoft.Toolkit.Uwp.UI.Controls |
## API
* [TileControl source code](https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/TileControl)

Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 117 KiB

После

Ширина:  |  Высота:  |  Размер: 117 KiB