Skip to content
Merged

1.4.0 #1061

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
261 commits
Select commit Hold shift + click to select a range
f4682be
Merge branch 'dev' of https://github.com/Microsoft/UWPCommunityToolki…
Romasz Feb 12, 2017
68f8729
Merge pull request #915 from Microsoft/Cache-MemStoreLookup
IbraheemOsama Feb 12, 2017
8ff766a
Use ConcurrentDictionary instead of Dictionary / OrderedDictionary
hermitdave Feb 12, 2017
993b40b
for Onedrive consumer, support OrderBy descending size, and ascending…
ericleigh007 Feb 12, 2017
59427ac
Maintain First In First Out when removing items from InMemoryStorage
hermitdave Feb 13, 2017
8557892
changes request + tweak
hermitdave Feb 13, 2017
1823cc7
Merge pull request #926 from ericleigh007/dev
deltakosh Feb 13, 2017
00ba32b
fix #920
nmetulev Feb 13, 2017
e5932fa
Add DecodePixelHeight, DecodePixelType and DecodePixelWidth propertie…
hermitdave Feb 13, 2017
0917a4a
suggested changes to avoid breaking changes
hermitdave Feb 13, 2017
87a104c
Merge pull request #930 from Microsoft/animations
hermitdave Feb 13, 2017
6aa297b
ensure that key in keyvalue pair is not null
hermitdave Feb 13, 2017
68ddacc
changes requested
hermitdave Feb 13, 2017
a39abc6
Merge pull request #925 from Microsoft/Cache-Concurrency
deltakosh Feb 13, 2017
b5b098c
Fixed nugets description (#911)
deltakosh Feb 13, 2017
24e13e4
changes requested
hermitdave Feb 13, 2017
2539d91
Merge pull request #931 from Microsoft/ImageEx-DecodeProperties
shenchauhan Feb 13, 2017
7333a06
Attach behaviors according to Mode while initializing
pdehne Feb 14, 2017
41ee1ee
Merge pull request #933 from pdehne/dev
pedrolamas Feb 14, 2017
6e7b94c
Merge pull request #890 from Romasz/dev
deltakosh Feb 14, 2017
51cda89
fixes for 935 and 934
nmetulev Feb 14, 2017
0472b37
Missing converters from PR #462
hermitdave Feb 14, 2017
8d2e9ca
Merge pull request #937 from Microsoft/Missing-Converters
hermitdave Feb 14, 2017
1f25aee
Accessibility check for BladeView
deltakosh Feb 14, 2017
7d63956
Make TargetListViewBase actually return a ListViewBase
pdehne Feb 15, 2017
ccc6eb2
Merge branch 'master' of https://github.com/Mimetis/UWPCommunityToolk…
Mimetis Feb 15, 2017
a5f3912
Add missing properties (include URLs and Media)
Feb 15, 2017
a0e5737
Change Sample page. Use RequestAsync instead of GetUserTimeLineAsync
Feb 15, 2017
4a76732
Sample: Add ScreenName in the Query
Feb 15, 2017
dc32079
Merge branch 'dev' into TwitterMissingProperties
CarteKiwi Feb 15, 2017
da85580
Removed extra line and unused nuget package
Feb 15, 2017
e9a08a7
Merge
Feb 15, 2017
ecedbc5
Restore initial sample
Feb 15, 2017
184a2f3
Remove stylecop package
Feb 15, 2017
8e40d40
Fix StyleCop...
Feb 15, 2017
dedb277
rotator tile accessibility check
deltakosh Feb 15, 2017
f2b54b6
DropShadowPanel Accessibility check
deltakosh Feb 15, 2017
f1e1439
Expander Accessibility check
deltakosh Feb 15, 2017
1ff1196
Add copyrights and headers
Feb 15, 2017
c884dfa
Adding keyboard support + accessibility check to GridSplitter
deltakosh Feb 15, 2017
c57c26d
Fix Namespace for WebViewExtensions
darshanrampatel Feb 15, 2017
984d107
Merge pull request #1 from darshanrampatel/darshanrampatel-patch-1
darshanrampatel Feb 15, 2017
fe67bd1
Merge pull request #949 from darshanrampatel/dev
deltakosh Feb 15, 2017
fa3b30a
[Twitter] Missing properties (#947)
CarteKiwi Feb 15, 2017
adb5cf4
RadialGauge accessibility check
deltakosh Feb 15, 2017
2434040
Commented out the FocusTracker
deltakosh Feb 15, 2017
c3bac4d
Update GridSplitterPage.xaml
deltakosh Feb 16, 2017
bc72077
better keyboard tracking for GridSplitter
deltakosh Feb 16, 2017
57529f2
Merge branch 'accessibility' of https://github.com/Microsoft/UWPCommu…
deltakosh Feb 16, 2017
d801ef1
Add TranslatorServiceException and better documentation
marcominerva Feb 16, 2017
52d06d9
Add missing headers
marcominerva Feb 16, 2017
78859b9
[MarkdownTextBlock) Added triple backticks support for codeblock
deltakosh Feb 16, 2017
0d530ac
[MarkdownTextBlock] Add support for images
deltakosh Feb 16, 2017
ad58b49
Change the photos from png to jpg to save space
skendrot Feb 16, 2017
164eb50
Added LinkForeground property
deltakosh Feb 16, 2017
f9608a0
markdown: Added support for ms-windows-store moniker in links
deltakosh Feb 16, 2017
ff4fdc5
Optimize png images
skendrot Feb 17, 2017
3fc24ad
Resize sample page icons to 120x120
skendrot Feb 17, 2017
e261664
Corrects scroll behavior for HamburgerMenu
amkuchta Feb 17, 2017
3a35545
Fixed #905
Feb 17, 2017
deda6ec
Merge pull request #959 from skendrot/ImageSize
skendrot Feb 17, 2017
1789d1d
more on #905,removing unnecessary lines
Feb 17, 2017
a4c1a0d
Merge pull request #961 from liakamp/issue-905
deltakosh Feb 17, 2017
8cb290a
Merge pull request #958 from Microsoft/markdownupgrades
deltakosh Feb 17, 2017
78edd59
range slider thumb area is bigger to work better with touch
Feb 17, 2017
2746b5a
option for touch optimization as a DP
Feb 18, 2017
fd36d63
Merge pull request #960 from amkuchta/dev
IbraheemOsama Feb 19, 2017
86e85c0
DropShadowPanel IsTabStop property should be False.
Feb 21, 2017
06a55e4
Merge pull request #975 from h82258652/h82258652
deltakosh Feb 21, 2017
06c04fd
null checks for slider elements arrangement
Feb 21, 2017
942bd64
Update HamburgerMenu docs
awkoren Feb 22, 2017
a86b77d
Merge pull request #982 from awkoren/patch-1
deltakosh Feb 22, 2017
71553bc
Merge pull request #936 from Microsoft/pulltorefreshfixes
deltakosh Feb 22, 2017
d40bbe7
Merge remote-tracking branch 'refs/remotes/origin/dev'
deltakosh Feb 22, 2017
334812f
Merge pull request #940 from pdehne/dev
deltakosh Feb 22, 2017
013d45c
Merge upstream
deltakosh Feb 22, 2017
6df1475
NetworkHelper initial commit
hermitdave Feb 22, 2017
2993308
Twitter streams added.
Feb 22, 2017
cc87da1
Merge pull request #964 from liakamp/rangeslider-improvements
deltakosh Feb 23, 2017
53f2be3
push missing files
hermitdave Feb 23, 2017
f5054f3
fix file header
hermitdave Feb 23, 2017
99d9d6e
Tweaks based on feedback
hermitdave Feb 24, 2017
a0dad6a
Fixes #977
deltakosh Feb 24, 2017
d4208b7
removed unused using
deltakosh Feb 24, 2017
895f7d4
Merge branch 'dev' into NetworkHelper-HD
deltakosh Feb 24, 2017
34b301e
fix(sample): push toast notification in background task single proces…
Odonno Feb 17, 2017
5a114c9
fix(backgroundTask): use real string value to resigter tasks
Odonno Feb 25, 2017
c8074e5
docs(backgroundTask): update sample page to use both spm and mpm
Odonno Feb 25, 2017
a8685a7
docs(backgroundTask): update docs md file
Odonno Feb 25, 2017
d8a9df6
-Added Refresh method
ianier Feb 25, 2017
962b5b0
New Carousel Control. Inherits from ItemsControl, Keyboard and mouse …
Feb 25, 2017
d924275
XamlStyler pase
Feb 25, 2017
ba54cf2
Update Headers
Feb 25, 2017
8ac7cc2
Close the connection with twitter stream and add summary
Feb 25, 2017
b408e13
fix(backgroundTask): create winrt component project to create backgro…
Odonno Feb 25, 2017
81307be
Added support for Event and Direct messages type
Feb 26, 2017
aa92468
DeletedEvents added and ITwitterResult implemented
Feb 27, 2017
94b5fed
Merge pull request #965 from Odonno/fixBackgroundTaskSpm
deltakosh Feb 27, 2017
d78d5a8
Merge pull request #989 from Microsoft/markdownUpdates
deltakosh Feb 28, 2017
1a583e4
Merge pull request #950 from Microsoft/accessibility
deltakosh Feb 28, 2017
c0fa644
Fix warnings
deltakosh Feb 28, 2017
392e5c2
Changed Refresh to RefreshAsync
ianier Feb 28, 2017
424cbd8
removed "this" when referring to a property
ianier Feb 28, 2017
8d45390
Fixes #969
deltakosh Feb 28, 2017
110608c
ImageEx LoadImageAsync changes
hermitdave Mar 1, 2017
148cc12
Make sample app orientation agnostic
hermitdave Mar 1, 2017
c0452c4
Pass uri to LoadImageAsync instead of creating a local variable
hermitdave Mar 1, 2017
4ccb74a
Merge pull request #993 from Microsoft/ImageEx-SourceFix
hermitdave Mar 1, 2017
8c61e7d
Merge pull request #990 from ianier/incloadingcolrefresh
hermitdave Mar 1, 2017
7d5188d
Merge pull request #991 from Microsoft/fixhamburgerback
deltakosh Mar 1, 2017
5c4f09e
Update appveyor.yml
Mar 1, 2017
e8d35d5
Update appveyor.yml
Mar 1, 2017
ec60673
Merge branch 'dev' into Fix-Sample-Orientation
deltakosh Mar 1, 2017
df80362
Fix TextBoxRegex and TextboxMask for landscape orientation
deltakosh Mar 1, 2017
a3e7df1
Add Copy button to code samples
deltakosh Mar 1, 2017
04d28cb
Merge branch 'dev' into NetworkHelper-HD
deltakosh Mar 1, 2017
6a730a6
Fix sample app ref
deltakosh Mar 1, 2017
15293cd
Fix references to obsolote ConnectionHelper
deltakosh Mar 1, 2017
5cc8344
Methods renamed and sample documented
Mar 1, 2017
5ba3e86
Update Twitter.md
CarteKiwi Mar 1, 2017
db70151
Update doc
Mar 1, 2017
5f854cc
Doc updated
Mar 1, 2017
f445994
Sync upstream
Mar 1, 2017
e09857b
Fix naming and event unhooking
deltakosh Mar 2, 2017
1aa6e51
Add missing header
Mar 2, 2017
18f4d43
Merge pull request #953 from marcominerva/dev
deltakosh Mar 2, 2017
9a3bfd5
Merge pull request #994 from Microsoft/Fix-Sample-Orientation
deltakosh Mar 2, 2017
dfbe864
Fixes #972
deltakosh Mar 2, 2017
6ccfc24
Modifications from request changes
Mimetis Mar 2, 2017
a3d6f63
Deleting unecessary comments :)
Mimetis Mar 2, 2017
5ebc7e1
requested changes
deltakosh Mar 2, 2017
dc871b6
Make the sample a bit more friendly.
Mar 2, 2017
fdf471b
Merge pull request #997 from Microsoft/copyToClipboard
deltakosh Mar 3, 2017
a7ea337
ViewExtensions and sample
hermitdave Feb 24, 2017
956f040
Update headers
hermitdave Mar 3, 2017
1db0f6f
Documentation and corrections
hermitdave Mar 3, 2017
606f891
Theme-dependent colors in MarkdownTextBlock #1001
tipa Mar 3, 2017
7b9647d
Rename HttpHelper GetRequestAsync to GetInputStreamAsync
hermitdave Mar 4, 2017
18a0c96
Merge pull request #999 from CarteKiwi/TwitterStreamingApi
hermitdave Mar 5, 2017
8783cf8
Check IsSupported before accessing Compositor to prevent unhandled ex…
Mar 6, 2017
8495209
Merge pull request #1009 from Microsoft/Fix-DropShadowPanel
hermitdave Mar 6, 2017
b71f75c
Introduce BehaviorBase and let FadeHeaderBehavior derive from this base
GeertvanHorrik Mar 6, 2017
9de574a
QuickReturnHeaderBehavior and StickyHeaderBehavior also derive from B…
GeertvanHorrik Mar 6, 2017
df9a240
Improve BehaviorBase::Detach method
GeertvanHorrik Mar 6, 2017
e40ec53
Expose more properties
hermitdave Mar 6, 2017
ebd9212
Change IsVisible to dependency property.
hermitdave Mar 6, 2017
944a8af
Merge pull request #1004 from tipa/dev
deltakosh Mar 6, 2017
5278524
First commit of DeveloperTools
deltakosh Mar 7, 2017
3cf2b76
Added doc image
deltakosh Mar 7, 2017
b9356cf
Fixing nuspec
deltakosh Mar 7, 2017
be1f240
Improved FocusTracker
deltakosh Mar 8, 2017
50c2840
Fix some minor issues
deltakosh Mar 8, 2017
1a1ed4a
Fix PrintHelper.OnPreviewpagesCreated bug with orientation changes
deltakosh Mar 8, 2017
dce3f67
Merge pull request #1017 from Microsoft/printfix
deltakosh Mar 8, 2017
f43a3d2
Added missing images
deltakosh Mar 8, 2017
1baf622
Merge pull request #1000 from Microsoft/fixAdaptiveViewScrollbar
deltakosh Mar 8, 2017
fd52acb
Add missing pfx
deltakosh Mar 8, 2017
e777e9c
Fixed headers
deltakosh Mar 8, 2017
d809155
rename extension classes
hermitdave Mar 8, 2017
eab0c09
Code complete
shenchauhan Mar 8, 2017
6e85397
Use Page rather than DependencyObject
hermitdave Mar 9, 2017
1cdbcb7
Revert sample bind and set IsVisible to false in Shell.xaml
hermitdave Mar 9, 2017
1cc74cf
Add focus visual style
Mimetis Mar 9, 2017
9beeb77
Add SelectedItem property
Mimetis Mar 9, 2017
b927b4e
merge conflicts
Mimetis Mar 9, 2017
2cf15d5
typos corrections, remove unused using statements, remove this keywor…
Mimetis Mar 9, 2017
1099787
correcting a bug preventing the carousel to show after first load
Mimetis Mar 9, 2017
057e7a2
Merge pull request #1002 from Microsoft/ViewHelpers-HD
hermitdave Mar 9, 2017
ba0edf6
Add HamburgerVisibility property
lukasf Mar 9, 2017
f30d90c
Cleaning up the code
shenchauhan Mar 9, 2017
0288079
Adding documentation
shenchauhan Mar 9, 2017
edac81d
merging from Microsoft dev
shenchauhan Mar 9, 2017
b9f5ecb
Fixing typo in documention
shenchauhan Mar 10, 2017
984ad62
Change depth property type to int
Mimetis Mar 10, 2017
881f46e
Removing Manipulations from the Carousel control and set the Backgrou…
Mimetis Mar 10, 2017
10ee204
Correcting else if
Mimetis Mar 10, 2017
661a277
removing reference to CarouselPanel into Carousel control
Mimetis Mar 10, 2017
a44dee5
Trying to make a better description for InvertPositive property
Mimetis Mar 10, 2017
67832c5
searchbox for sample app
deltakosh Mar 10, 2017
50c6d2a
use AutoSuggestBox instead of SearchBox
deltakosh Mar 10, 2017
fabc32e
- Fix usage of wrong field in BehaviorBase
GeertvanHorrik Mar 11, 2017
0670343
Merge pull request #1020 from lukasf/dev
IbraheemOsama Mar 13, 2017
31bacc6
Add a CommandBar for the master and details section. Fixes #893
skendrot Mar 13, 2017
654991c
Fixed focus and added suggestions
deltakosh Mar 13, 2017
0ea54d6
Merge conflicts
deltakosh Mar 13, 2017
3ab35bd
fixed conflicts
nmetulev Mar 13, 2017
5f062f8
updated directional navigation to work better for xbox
nmetulev Mar 13, 2017
fd0fa0d
Merge pull request #1018 from Microsoft/developerTools
deltakosh Mar 13, 2017
53e9abd
added AutomationProperty.Name
nmetulev Mar 13, 2017
4775e9c
Compare ImageEx Source before setting it internally to prevent reload
hermitdave Mar 13, 2017
84a8f64
fixed merge conflict yet again
nmetulev Mar 13, 2017
e196998
Merge branch 'dev' into NetworkHelper-HD
deltakosh Mar 13, 2017
ec2c0fc
Merge pull request #984 from Microsoft/NetworkHelper-HD
hermitdave Mar 13, 2017
ae35e4a
Fix conflicts
deltakosh Mar 13, 2017
40e6186
Merge pull request #1030 from Microsoft/NetworkHelper-HD
deltakosh Mar 13, 2017
845d23d
Merge pull request #1029 from Microsoft/ImageEx-SourceCheck
hermitdave Mar 13, 2017
8ccbb86
Add foreground for markdown textblock header 1 through 6
haefele Mar 13, 2017
4acb0e7
tiny fix on AdvancedCollectionView; #914
xied75 Mar 14, 2017
795decf
Merge pull request #1031 from haefele/markdown_textblock_header_foreg…
deltakosh Mar 14, 2017
3856d1b
Merge pull request #1024 from Microsoft/searchBox
deltakosh Mar 15, 2017
2ed36cc
Merge branch 'dev' into Mimetis-dev
nmetulev Mar 16, 2017
649baef
updated focus management of carousel
nmetulev Mar 16, 2017
e2634ec
playing with inertia
nmetulev Mar 16, 2017
56cfc2f
Update Saturation.cs
shenchauhan Mar 16, 2017
c715b87
Merge pull request #1021 from shenchauhan/effects
nmetulev Mar 16, 2017
a8de83f
All behaviors derive from BehaviorBase
GeertvanHorrik Mar 16, 2017
592fb28
Better folder naming for developer tools docs
deltakosh Mar 16, 2017
89290ff
Fixed alignmentgrid image in docs/developer tools/AlignmentGrid.md
deltakosh Mar 16, 2017
60a72c3
Update AlignmentGrid.md
deltakosh Mar 16, 2017
2603354
continuing inertia investigation
nmetulev Mar 17, 2017
41938a9
Merge branch 'dev' of https://github.com/Microsoft/UWPCommunityToolki…
Mimetis Mar 17, 2017
41c4fd8
Merge remote-tracking branch 'refs/remotes/upstream/Mimetis-dev'
Mimetis Mar 17, 2017
1babeff
Fix color helper calculations
dguenther Mar 19, 2017
a8b7233
Fix RGB to HSL conversion when R is max
dguenther Mar 19, 2017
ab17139
Fix HSV calculation when R is max
dguenther Mar 19, 2017
02d649d
1. [AdvancedCollectionView]: revert back setter for CurrentItem, remove
xied75 Mar 20, 2017
b395692
Adding docs for Carousel control
Mimetis Mar 20, 2017
186e526
Fixing typos
Mimetis Mar 20, 2017
625f926
Merge pull request #1032 from xied75/issue-914
deltakosh Mar 20, 2017
6d4e836
Merge pull request #1039 from dguenther/fix-color-helpers
deltakosh Mar 20, 2017
d3c14eb
Merge pull request #1028 from skendrot/MasterDetailsCommandBar
deltakosh Mar 20, 2017
f5cb104
Merge pull request #712 from Mimetis/dev
deltakosh Mar 20, 2017
e3657e0
Update Carousel.md
deltakosh Mar 20, 2017
0c209ef
Revert to animation jump to item, keepin the control smooth
Mimetis Mar 20, 2017
b81a206
Merge pull request #1040 from Mimetis/dev
deltakosh Mar 20, 2017
94e6121
Removed warnings
deltakosh Mar 20, 2017
87047c9
Deprecate toast AfterActivationBehavior
Mar 20, 2017
1ad3421
Deprecate toast AfterActivationBehavior
Mar 20, 2017
fd72657
Merge pull request #1041 from Microsoft/anbare-deprecate-afteractivat…
deltakosh Mar 20, 2017
8a8ae01
Fix owner type of CompositionBehaviorBase
GeertvanHorrik Mar 21, 2017
2371043
Fix toast progress bar
Mar 22, 2017
20020fc
Merge pull request #1044 from Microsoft/anbare-fix-toast-progress-bar
deltakosh Mar 23, 2017
e51557b
Merge pull request #1010 from GeertvanHorrik/pr/behaviors
deltakosh Mar 23, 2017
8e073da
Fixed #1045
deltakosh Mar 23, 2017
238d287
Merge branch 'dev' of https://github.com/Microsoft/UWPCommunityToolki…
deltakosh Mar 23, 2017
3a1e59f
[BladeView] proper scroll for Data binding; fixing #801
xied75 Mar 24, 2017
de3145a
Fixes #1051
deltakosh Mar 27, 2017
fa7e24a
Fixed warnings in release mode
deltakosh Mar 28, 2017
15d6560
handling potential null exception for DropShadowPanel
deltakosh Mar 28, 2017
9d97238
Fixed errors when compiling UI project in release
deltakosh Mar 28, 2017
8eb2d96
Merge pull request #1053 from Microsoft/warningsfixes
deltakosh Mar 28, 2017
9208786
Fix small bugs with images
deltakosh Mar 28, 2017
a4067d6
Remove ArrangeForTouch call to preserve backward compat. The method w…
deltakosh Mar 28, 2017
4dcbdb2
Merge pull request #1054 from Microsoft/backCompat
deltakosh Mar 28, 2017
e635245
Merge pull request #1048 from xied75/issues-801
deltakosh Mar 28, 2017
ec918ff
Merge remote-tracking branch 'refs/remotes/Microsoft/dev' into GridSp…
IbraheemOsama Mar 31, 2017
26c25c8
#1036 removing redundant code
IbraheemOsama Mar 31, 2017
f772aa6
#1036 removing unused references
IbraheemOsama Mar 31, 2017
075844a
#1036 setting IsFocusEngagmentEnable
IbraheemOsama Mar 31, 2017
fcd3474
Merge pull request #1059 from IbraheemOsama/GridSplitterFocusTrap
deltakosh Mar 31, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
132 changes: 132 additions & 0 deletions Microsoft.Toolkit.Uwp.DeveloperTools/AlignmentGrid/AlignmentGrid.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// ******************************************************************
// 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 Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;

namespace Microsoft.Toolkit.Uwp.DeveloperTools
{
/// <summary>
/// AlignmentGrid is used to display a grid to help aligning controls
/// </summary>
public class AlignmentGrid: ContentControl
{
/// <summary>
/// Identifies the <see cref="LineBrush"/> dependency property.
/// </summary>
public static readonly DependencyProperty LineBrushProperty = DependencyProperty.Register(nameof(LineBrush), typeof(Brush), typeof(AlignmentGrid), new PropertyMetadata(null, OnPropertyChanged));

/// <summary>
/// Identifies the <see cref="HorizontalStep"/> dependency property.
/// </summary>
public static readonly DependencyProperty HorizontalStepProperty = DependencyProperty.Register(nameof(HorizontalStep), typeof(double), typeof(AlignmentGrid), new PropertyMetadata(20.0, OnPropertyChanged));

/// <summary>
/// Identifies the <see cref="VerticalStep"/> dependency property.
/// </summary>
public static readonly DependencyProperty VerticalStepProperty = DependencyProperty.Register(nameof(VerticalStep), typeof(double), typeof(AlignmentGrid), new PropertyMetadata(20.0, OnPropertyChanged));

private static void OnPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
{
var alignmentGrid = dependencyObject as AlignmentGrid;

alignmentGrid?.Rebuild();
}

private readonly Canvas containerCanvas = new Canvas();

/// <summary>
/// Gets or sets the step to use horizontally.
/// </summary>
public Brush LineBrush
{
get { return (Brush)GetValue(LineBrushProperty); }
set { SetValue(LineBrushProperty, value); }
}

/// <summary>
/// Gets or sets the step to use horizontally.
/// </summary>
public double HorizontalStep
{
get { return (double)GetValue(HorizontalStepProperty); }
set { SetValue(HorizontalStepProperty, value); }
}

/// <summary>
/// Gets or sets the step to use horizontally.
/// </summary>
public double VerticalStep
{
get { return (double)GetValue(VerticalStepProperty); }
set { SetValue(VerticalStepProperty, value); }
}


/// <summary>
/// Initializes a new instance of the <see cref="AlignmentGrid"/> class.
/// </summary>
public AlignmentGrid()
{
SizeChanged += AlignmentGrid_SizeChanged;

IsHitTestVisible = false;

Opacity = 0.5;

HorizontalContentAlignment = HorizontalAlignment.Stretch;
VerticalContentAlignment = VerticalAlignment.Stretch;
Content = containerCanvas;
}

private void Rebuild()
{
containerCanvas.Children.Clear();
var horizontalStep = HorizontalStep;
var verticalStep = VerticalStep;
var brush = LineBrush ?? (Brush)Application.Current.Resources["ApplicationForegroundThemeBrush"];

for (double x = 0; x < ActualWidth; x += horizontalStep)
{
var line = new Rectangle
{
Width = 1,
Height = ActualHeight,
Fill = brush
};
Canvas.SetLeft(line, x);

containerCanvas.Children.Add(line);
}

for (double y = 0; y < ActualHeight; y += verticalStep)
{
var line = new Rectangle
{
Width = ActualWidth,
Height = 1,
Fill = brush
};
Canvas.SetTop(line, y);

containerCanvas.Children.Add(line);
}
}

private void AlignmentGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
Rebuild();
}
}
}
153 changes: 153 additions & 0 deletions Microsoft.Toolkit.Uwp.DeveloperTools/FocusTracker/FocusTracker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
// ******************************************************************
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;

namespace Microsoft.Toolkit.Uwp.DeveloperTools
{
/// <summary>
/// FocusTracker can be used to display information about the current focused XAML element.
/// </summary>
[TemplatePart(Name = "ControlName", Type = typeof(TextBlock))]
[TemplatePart(Name = "ControlType", Type = typeof(TextBlock))]
[TemplatePart(Name = "ControlAutomationName", Type = typeof(TextBlock))]
[TemplatePart(Name = "ControlFirstParentWithName", Type = typeof(TextBlock))]
public class FocusTracker: Control
{
/// <summary>
/// Defines the <see cref="IsActive"/> dependency property.
/// </summary>
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register(nameof(IsActive), typeof(bool), typeof(FocusTracker), new PropertyMetadata(false, OnIsActiveChanged));

private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var focusTracker = d as FocusTracker;

if (e.NewValue != null && (bool) e.NewValue)
{
focusTracker?.Start();
}
else
{
focusTracker?.Stop();
}
}

private DispatcherTimer updateTimer;
private TextBlock controlName;
private TextBlock controlType;
private TextBlock controlAutomationName;
private TextBlock controlFirstParentWithName;

/// <summary>
/// Gets or sets a boolean indicating whether the tracker is running or not.
/// </summary>
public bool IsActive
{
get { return (bool) GetValue(IsActiveProperty); }
set
{
SetValue(IsActiveProperty, value);
}
}

/// <summary>
/// Initializes a new instance of the <see cref="FocusTracker"/> class.
/// </summary>
public FocusTracker()
{
DefaultStyleKey = typeof(FocusTracker);
}

private void Start()
{
if (updateTimer == null)
{
updateTimer = new DispatcherTimer();
updateTimer.Tick += UpdateTimer_Tick;
}
updateTimer.Start();
}

private void Stop()
{
updateTimer?.Stop();
ClearContent();
}

/// <summary>
/// Update the visual state of the control when its template is changed.
/// </summary>
protected override void OnApplyTemplate()
{
controlName = GetTemplateChild("ControlName") as TextBlock;
controlType = GetTemplateChild("ControlType") as TextBlock;
controlAutomationName = GetTemplateChild("ControlAutomationName") as TextBlock;
controlFirstParentWithName = GetTemplateChild("ControlFirstParentWithName") as TextBlock;
}

private void ClearContent()
{
controlName.Text = string.Empty;
controlType.Text = string.Empty;
controlAutomationName.Text = string.Empty;
controlFirstParentWithName.Text = string.Empty;
}

private void UpdateTimer_Tick(object sender, object e)
{
var focusedControl = FocusManager.GetFocusedElement() as FrameworkElement;

if (focusedControl == null)
{
ClearContent();
return;
}

controlName.Text = focusedControl.Name;
controlType.Text = focusedControl.GetType().Name;
controlAutomationName.Text = AutomationProperties.GetName(focusedControl);

var parentWithName = FindVisualAscendantWithName(focusedControl);

controlFirstParentWithName.Text = parentWithName?.Name ?? string.Empty;
}

private FrameworkElement FindVisualAscendantWithName(FrameworkElement element)
{
var parent = VisualTreeHelper.GetParent(element) as FrameworkElement;

if (parent == null)
{
return null;
}

if (!string.IsNullOrEmpty(parent.Name))
{
return parent;
}

return FindVisualAscendantWithName(parent);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:developerTools="using:Microsoft.Toolkit.Uwp.DeveloperTools">

<Style TargetType="developerTools:FocusTracker">
<Setter Property="IsTabStop" Value="False"></Setter>
<Setter Property="MinWidth" Value="300"></Setter>
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}"></Setter>
<Setter Property="Background" Value="{ThemeResource ApplicationPageBackgroundThemeBrush}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding Foreground}"
BorderThickness="1"
/>
<Grid Padding="10,10,10,5">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="Name:"
FontSize="14"
Grid.Row="0"
Grid.Column="0"/>
<TextBlock x:Name="ControlName"
Grid.Row="0"
Grid.Column="1"/>

<TextBlock Text="Type:"
FontSize="14"
Grid.Row="1"
Grid.Column="0"/>
<TextBlock x:Name="ControlType"
Grid.Row="1"
Grid.Column="1"/>

<TextBlock Text="Automation.Name:"
FontSize="14"
Grid.Row="2"
Grid.Column="0"/>
<TextBlock x:Name="ControlAutomationName"
Grid.Row="2"
Grid.Column="1"/>

<TextBlock Text="Parent with Name:"
FontSize="14"
Grid.Row="3"
Grid.Column="0"/>
<TextBlock x:Name="ControlFirstParentWithName"
Grid.Row="3"
Grid.Column="1"/>

<TextBlock Text="FocusTracker"
Opacity="0.5"
FontSize="14"
HorizontalAlignment="Center"
Grid.Row="4"
Grid.ColumnSpan="2"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
Loading