Updated leftover references in the codebase

This commit is contained in:
Sergio Pedri 2021-01-22 17:08:04 +01:00
Родитель b1dfbdd65d
Коммит b50f3ed2a2
29 изменённых файлов: 48 добавлений и 54 удалений

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

@ -25,8 +25,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
bladeView = control.FindChildByName("BladeView") as BladeView;
addBlade = control.FindChildByName("AddBlade") as Button;
bladeView = control.FindChild("BladeView") as BladeView;
addBlade = control.FindChild("AddBlade") as Button;
if (addBlade != null)
{

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

@ -9,7 +9,6 @@ using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
@ -29,7 +28,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
_sampleDockPanel = control.FindChildByName("SampleDockPanel") as DockPanel;
_sampleDockPanel = control.FindChild("SampleDockPanel") as DockPanel;
}
private void Load()

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

@ -26,7 +26,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
myListView = control.FindChildByName("MyListView") as ListView;
myListView = control.FindChild("MyListView") as ListView;
// Load the ListView with Sample Data
if (myListView != null)

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

@ -2,13 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Shapes;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
@ -33,7 +31,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
WarnUserToPlugInDevice();
var buttonControl = control.FindChildByName("TargetButton") as Button;
var buttonControl = control.FindChild("TargetButton") as Button;
if (buttonControl != null)
{

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

@ -42,7 +42,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
if (control.FindChildByName("Points") is ItemsControl itemsControl)
if (control.FindChild("Points") is ItemsControl itemsControl)
{
itemsControl.ItemsSource = GazeHistory;
}

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

@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Linq;
using Microsoft.Toolkit.Uwp.UI.Controls;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.UI.Xaml;
@ -26,7 +27,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement element)
{
foreach (var control in element.FindChildren<HeaderedItemsControl>())
foreach (var control in element.FindChildren().OfType<HeaderedItemsControl>())
{
control.DataContext = this;
}

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

@ -29,7 +29,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
photoList = control.FindChildByName("PhotoList") as ListView;
photoList = control.FindChild("PhotoList") as ListView;
}
private async void Load()

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

@ -4,12 +4,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Microsoft.Toolkit.Uwp.UI.Controls;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Graphics.Imaging;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
@ -35,7 +32,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public async void OnXamlRendered(FrameworkElement control)
{
_imageCropper = control.FindChildByName("ImageCropper") as ImageCropper;
_imageCropper = control.FindChild("ImageCropper") as ImageCropper;
if (_imageCropper != null)
{
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Photos/Owl.jpg"));

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

@ -32,9 +32,9 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
// Need to use logical tree here as scrollviewer hasn't initialized yet even with dispatch.
container = control.FindChildByName("Container") as StackPanel;
container = control.FindChild("Container") as StackPanel;
resources = control.Resources;
lazyLoadingControlHost = control.FindChildByName("LazyLoadingControlHost") as Border;
lazyLoadingControlHost = control.FindChild("LazyLoadingControlHost") as Border;
}
private async void Load()

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

@ -27,7 +27,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
_element = control.FindChildByName("Element");
_element = control.FindChild("Element");
}
private void Load()

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

@ -35,14 +35,14 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
NotificationDuration = 0;
_exampleInAppNotification = control.FindChildByName("ExampleInAppNotification") as InAppNotification;
_exampleInAppNotification = control.FindChild("ExampleInAppNotification") as InAppNotification;
_defaultInAppNotificationControlTemplate = _exampleInAppNotification?.Template;
_exampleCustomInAppNotification = control.FindChildByName("ExampleCustomInAppNotification") as InAppNotification;
_exampleCustomInAppNotification = control.FindChild("ExampleCustomInAppNotification") as InAppNotification;
_customInAppNotificationControlTemplate = _exampleCustomInAppNotification?.Template;
_exampleVSCodeInAppNotification = control.FindChildByName("ExampleVSCodeInAppNotification") as InAppNotification;
_exampleVSCodeInAppNotification = control.FindChild("ExampleVSCodeInAppNotification") as InAppNotification;
_resources = control.Resources;
var notificationDurationTextBox = control.FindChildByName("NotificationDurationTextBox") as TextBox;
var notificationDurationTextBox = control.FindChild("NotificationDurationTextBox") as TextBox;
if (notificationDurationTextBox != null)
{
notificationDurationTextBox.TextChanged += NotificationDurationTextBox_TextChanged;

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

@ -29,7 +29,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
_infiniteCanvas = control.FindChildByName("canvas") as InfiniteCanvas;
_infiniteCanvas = control.FindChild("canvas") as InfiniteCanvas;
}
private void Load()

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

@ -19,7 +19,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public async void OnXamlRendered(FrameworkElement control)
{
imageView = control.FindChildByName("ImageView") as GridView;
imageView = control.FindChild("ImageView") as GridView;
if (imageView != null)
{

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

@ -24,7 +24,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public async void OnXamlRendered(FrameworkElement control)
{
var sampleListView = control.FindChildByName("SampleListView") as ListView;
var sampleListView = control.FindChild("SampleListView") as ListView;
if (sampleListView != null)
{

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

@ -25,10 +25,10 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public async void OnXamlRendered(FrameworkElement control)
{
loadingControl = control.FindDescendant("LoadingControl") as Loading;
loadingContentControl = control.FindChildByName("LoadingContentControl") as ContentControl;
loadingContentControl = control.FindChild("LoadingContentControl") as ContentControl;
resources = control.Resources;
if (control.FindChildByName("AdaptiveGridViewControl") is AdaptiveGridView gridView)
if (control.FindChild("AdaptiveGridViewControl") is AdaptiveGridView gridView)
{
gridView.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
}

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

@ -31,9 +31,9 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
unformattedText = control.FindChildByName("UnformattedText") as TextBox;
unformattedText = control.FindChild("UnformattedText") as TextBox;
markdownText = control.FindChildByName("MarkdownText") as MarkdownTextBlock;
markdownText = control.FindChild("MarkdownText") as MarkdownTextBlock;
if (markdownText != null)
{

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

@ -22,7 +22,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
fileMenu = control.FindChildByName("FileMenu") as MenuItem;
fileMenu = control.FindChild("FileMenu") as MenuItem;
}
#pragma warning restore CS0618 // Type or member is obsolete

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

@ -28,13 +28,13 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
var people = control.FindChildByName("People") as OrbitView;
var people = control.FindChild("People") as OrbitView;
if (people != null)
{
people.ItemClick += People_ItemClick;
}
var devices = control.FindChildByName("Devices") as OrbitView;
var devices = control.FindChild("Devices") as OrbitView;
if (devices != null)
{
devices.ItemsSource = DeviceList;

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

@ -10,7 +10,6 @@ using Windows.Graphics.Printing;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
@ -40,7 +39,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
var listView = control.FindChildByName("PrintSampleListView") as ListView;
var listView = control.FindChild("PrintSampleListView") as ListView;
if (listView == null)
{
customPrintTemplate = null;

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

@ -22,28 +22,28 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
var tile1 = control.FindChildByName("Tile1") as RotatorTile;
var tile1 = control.FindChild("Tile1") as RotatorTile;
if (tile1 != null)
{
tile1.ItemsSource = _pictures;
}
var tile2 = control.FindChildByName("Tile2") as RotatorTile;
var tile2 = control.FindChild("Tile2") as RotatorTile;
if (tile2 != null)
{
tile2.ItemsSource = _pictures;
}
var tile3 = control.FindChildByName("Tile3") as RotatorTile;
var tile3 = control.FindChild("Tile3") as RotatorTile;
if (tile3 != null)
{
tile3.ItemsSource = _pictures;
}
var tile4 = control.FindChildByName("Tile4") as RotatorTile;
var tile4 = control.FindChild("Tile4") as RotatorTile;
if (tile4 != null)
{

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

@ -22,7 +22,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
var listView = control.FindChildByName("listView") as ListView;
var listView = control.FindChild("listView") as ListView;
if (listView != null)
{
listView.ItemsSource = _items;

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

@ -30,12 +30,12 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
var listView = control.FindChildByName("listView") as ListView;
var listView = control.FindChild("listView") as ListView;
if (listView != null)
{
listView.ItemsSource = _items;
var shapesPanel = control.FindChildByName("shapesPanel") as StackPanel;
var shapesPanel = control.FindChild("shapesPanel") as StackPanel;
if (shapesPanel != null)
{
var listScrollViewer = listView.FindDescendant<ScrollViewer>();

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

@ -21,7 +21,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public async void OnXamlRendered(FrameworkElement control)
{
var gridView = control.FindChildByName("GridView") as ItemsControl;
var gridView = control.FindChild("GridView") as ItemsControl;
if (gridView == null)
{

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

@ -23,7 +23,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
alphaTextBox = control.FindChildByName("AlphaTextBox") as TextBox;
alphaTextBox = control.FindChild("AlphaTextBox") as TextBox;
}
private void Load()

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

@ -28,14 +28,14 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
_toolbar = control.FindChildByName("Toolbar") as TextToolbar;
_toolbar = control.FindChild("Toolbar") as TextToolbar;
if (control.FindChildByName("EditZone") is RichEditBox editZone)
if (control.FindChild("EditZone") is RichEditBox editZone)
{
editZone.TextChanged += EditZone_TextChanged;
}
if (control.FindChildByName("Previewer") is MarkdownTextBlock previewer)
if (control.FindChild("Previewer") is MarkdownTextBlock previewer)
{
_previewer = previewer;
_previewer.LinkClicked += Previewer_LinkClicked;

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

@ -123,7 +123,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
_ttb.TokenItemAdding -= TokenItemCreating;
}
if (control.FindChildByName("TokenBox") is TokenizingTextBox ttb)
if (control.FindChild("TokenBox") is TokenizingTextBox ttb)
{
_ttb = ttb;
_ttb.TokenItemAdded += TokenItemAdded;
@ -147,7 +147,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
_ttbEmail.PreviewKeyDown -= EmailPreviewKeyDown;
}
if (control.FindChildByName("TokenBoxEmail") is TokenizingTextBox ttbEmail)
if (control.FindChild("TokenBoxEmail") is TokenizingTextBox ttbEmail)
{
_ttbEmail = ttbEmail;
@ -168,7 +168,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
_ttbEmailSuggestions.PreviewKeyDown -= EmailList_PreviewKeyDown;
}
if (control.FindChildByName("EmailList") is ListView ttbList)
if (control.FindChild("EmailList") is ListView ttbList)
{
_ttbEmailSuggestions = ttbList;

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

@ -35,13 +35,13 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
if (control.FindChildByName("EffectElement") is Image effectElement)
if (control.FindChild("EffectElement") is Image effectElement)
{
_effectElement = effectElement;
////TODO: _effectElement.Blur(value: 10, duration: 0).Start();
}
if (control.FindChildByName("EffectElementHost") is FrameworkElement effectElementHost)
if (control.FindChild("EffectElementHost") is FrameworkElement effectElementHost)
{
var behaviors = Interaction.GetBehaviors(effectElementHost);
var viewportBehavior = behaviors.OfType<ViewportBehavior>().FirstOrDefault();

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

@ -29,7 +29,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public void OnXamlRendered(FrameworkElement control)
{
_itemControl = control.FindChildByName("WrapPanelContainer") as ListView;
_itemControl = control.FindChild("WrapPanelContainer") as ListView;
if (_itemControl != null)
{

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

@ -44,7 +44,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
var scrollViewer = sender as ScrollViewer ?? sender.FindDescendant<ScrollViewer>();
// Last scrollbar with "HorizontalScrollBar" as name is our target to set its margin and avoid it overlapping the header
var scrollBar = scrollViewer?.FindDescendants<ScrollBar>().LastOrDefault(bar => bar.Name == "HorizontalScrollBar");
var scrollBar = scrollViewer?.FindDescendants().OfType<ScrollBar>().LastOrDefault(bar => bar.Name == "HorizontalScrollBar");
if (scrollBar == null)
{
@ -99,7 +99,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
var scrollViewer = sender as ScrollViewer ?? sender.FindDescendant<ScrollViewer>();
// Last scrollbar with "HorizontalScrollBar" as name is our target to set its margin and avoid it overlapping the header
var scrollBar = scrollViewer?.FindDescendants<ScrollBar>().LastOrDefault(bar => bar.Name == "VerticalScrollBar");
var scrollBar = scrollViewer?.FindDescendants().OfType<ScrollBar>().LastOrDefault(bar => bar.Name == "VerticalScrollBar");
if (scrollBar == null)
{