Fixed some more leftover references
This commit is contained in:
Родитель
b50f3ed2a2
Коммит
bf823e0793
|
@ -95,7 +95,7 @@ Therefore, for any new control/extension, you should still have a simplified sni
|
|||
This gets called whenever the template gets parsed (due to loading or user modification). Here you can use the [LogicalTree](https://github.com/windows-toolkit/WindowsCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI/Extensions/Tree/LogicalTree.cs) extensions to grab named controls in the template and register their events. **Check for null first** as the developer may have removed the name from the element.
|
||||
|
||||
```csharp
|
||||
var markdownText = control.FindChildByName("MarkdownText") as MarkdownTextBlock;
|
||||
var markdownText = control.FindChild("MarkdownText") as MarkdownTextBlock;
|
||||
if (markdownText != null)
|
||||
{
|
||||
markdownText.LinkClicked += MarkdownText_LinkClicked;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace UnitTests.Extensions
|
|||
</Button>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeroot.FindChildByName("RootButton") as Button;
|
||||
var button = treeroot.FindChild("RootButton") as Button;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(Button)} control in tree.");
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace UnitTests.Extensions
|
|||
</Button>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeroot.FindChildByName("RootButton") as Button;
|
||||
var button = treeroot.FindChild("RootButton") as Button;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(Button)} control in tree.");
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace UnitTests.Extensions
|
|||
<ListView x:Name=""Check"" ItemsSource=""{ex:EnumValues Type=local:Animal}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var list = treeRoot.FindChildByName("Check") as ListView;
|
||||
var list = treeRoot.FindChild("Check") as ListView;
|
||||
|
||||
Assert.IsNotNull(list, "Could not find ListView control in tree.");
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace UnitTests.Extensions
|
|||
<AppBarButton x:Name=""Check"" Icon=""{ex:FontIcon Glyph=}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeroot.FindChildByName("Check") as AppBarButton;
|
||||
var button = treeroot.FindChild("Check") as AppBarButton;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(AppBarButton)} control in tree.");
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace UnitTests.Extensions
|
|||
<AppBarButton x:Name=""Check"" Icon=""{ex:FontIcon Glyph=, FontFamily='Segoe UI'}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeroot.FindChildByName("Check") as AppBarButton;
|
||||
var button = treeroot.FindChild("Check") as AppBarButton;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(AppBarButton)} control in tree.");
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace UnitTests.Extensions
|
|||
<AppBarButton x:Name=""Check"" Icon=""{ex:FontIcon Glyph=, FontSize=7, FontFamily='Segoe MDL2 Assets', FontWeight=Bold, FontStyle=Italic, IsTextScaleFactorEnabled=True, MirroredWhenRightToLeft=True}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeroot.FindChildByName("Check") as AppBarButton;
|
||||
var button = treeroot.FindChild("Check") as AppBarButton;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(AppBarButton)} control in tree.");
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace UnitTests.Extensions
|
|||
<controls:MockSwipeItem x:Name=""Check"" IconSource=""{ex:FontIconSource Glyph=}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeRoot.FindChildByName("Check") as MockSwipeItem;
|
||||
var button = treeRoot.FindChild("Check") as MockSwipeItem;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(MockSwipeItem)} control in tree.");
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace UnitTests.Extensions
|
|||
<controls:MockSwipeItem x:Name=""Check"" IconSource=""{ex:FontIconSource Glyph=, FontFamily='Segoe UI'}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeRoot.FindChildByName("Check") as MockSwipeItem;
|
||||
var button = treeRoot.FindChild("Check") as MockSwipeItem;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(MockSwipeItem)} control in tree.");
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace UnitTests.Extensions
|
|||
<controls:MockSwipeItem x:Name=""Check"" IconSource=""{ex:FontIconSource Glyph=, FontSize=7, FontFamily='Segoe MDL2 Assets', FontWeight=Bold, FontStyle=Italic, IsTextScaleFactorEnabled=True, MirroredWhenRightToLeft=True}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var button = treeRoot.FindChildByName("Check") as MockSwipeItem;
|
||||
var button = treeRoot.FindChild("Check") as MockSwipeItem;
|
||||
|
||||
Assert.IsNotNull(button, $"Could not find the {nameof(MockSwipeItem)} control in tree.");
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace UnitTests.Extensions
|
|||
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool Value=True}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var toggle = treeroot.FindChildByName("Check") as CheckBox;
|
||||
var toggle = treeroot.FindChild("Check") as CheckBox;
|
||||
|
||||
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace UnitTests.Extensions
|
|||
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool Value=False}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var toggle = treeroot.FindChildByName("Check") as CheckBox;
|
||||
var toggle = treeroot.FindChild("Check") as CheckBox;
|
||||
|
||||
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace UnitTests.Extensions
|
|||
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool IsNull=True}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var toggle = treeroot.FindChildByName("Check") as CheckBox;
|
||||
var toggle = treeroot.FindChild("Check") as CheckBox;
|
||||
|
||||
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
|
||||
|
||||
|
@ -80,7 +80,7 @@ namespace UnitTests.Extensions
|
|||
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool IsNull=True, Value=True}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var toggle = treeroot.FindChildByName("Check") as CheckBox;
|
||||
var toggle = treeroot.FindChild("Check") as CheckBox;
|
||||
|
||||
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
|
||||
|
||||
|
@ -99,7 +99,7 @@ namespace UnitTests.Extensions
|
|||
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool IsNull=True, Value=False}""/>
|
||||
</Page>") as FrameworkElement;
|
||||
|
||||
var toggle = treeroot.FindChildByName("Check") as CheckBox;
|
||||
var toggle = treeroot.FindChild("Check") as CheckBox;
|
||||
|
||||
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var toolbar = treeRoot.FindChildByName("TextToolbarControl") as TextToolbar;
|
||||
var toolbar = treeRoot.FindChild("TextToolbarControl") as TextToolbar;
|
||||
|
||||
Assert.IsNotNull(toolbar, "Could not find TextToolbar in tree.");
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var tokenBox = treeRoot.FindChildByName("tokenboxname") as TokenizingTextBox;
|
||||
var tokenBox = treeRoot.FindChild("tokenboxname") as TokenizingTextBox;
|
||||
|
||||
Assert.IsNotNull(tokenBox, "Could not find TokenizingTextBox in tree.");
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -116,7 +116,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -176,7 +176,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -222,7 +222,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -232,14 +232,14 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
grid.Measure(new Size(1000, 1000));
|
||||
|
||||
var border = treeRoot.FindChildByName("OurItem") as Border;
|
||||
var border = treeRoot.FindChild("OurItem") as Border;
|
||||
|
||||
Assert.IsNotNull(border, "Could not find our item to test.");
|
||||
|
||||
Assert.AreEqual(1, Grid.GetRow(border));
|
||||
Assert.AreEqual(1, Grid.GetColumn(border));
|
||||
|
||||
var border2 = treeRoot.FindChildByName("Shifted") as Border;
|
||||
var border2 = treeRoot.FindChild("Shifted") as Border;
|
||||
|
||||
Assert.IsNotNull(border2, "Could not find shifted item to test.");
|
||||
|
||||
|
@ -269,7 +269,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -279,14 +279,14 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
grid.Measure(new Size(1000, 1000));
|
||||
|
||||
var border = treeRoot.FindChildByName("OurItem") as Border;
|
||||
var border = treeRoot.FindChild("OurItem") as Border;
|
||||
|
||||
Assert.IsNotNull(border, "Could not find our item to test.");
|
||||
|
||||
Assert.AreEqual(1, Grid.GetRow(border));
|
||||
Assert.AreEqual(1, Grid.GetColumn(border));
|
||||
|
||||
var border2 = treeRoot.FindChildByName("Shifted") as Border;
|
||||
var border2 = treeRoot.FindChild("Shifted") as Border;
|
||||
|
||||
Assert.IsNotNull(border2, "Could not find shifted item to test.");
|
||||
|
||||
|
@ -316,7 +316,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -326,14 +326,14 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
grid.Measure(new Size(1000, 1000));
|
||||
|
||||
var border = treeRoot.FindChildByName("OurItem") as Border;
|
||||
var border = treeRoot.FindChild("OurItem") as Border;
|
||||
|
||||
Assert.IsNotNull(border, "Could not find our item to test.");
|
||||
|
||||
Assert.AreEqual(0, Grid.GetRow(border));
|
||||
Assert.AreEqual(1, Grid.GetColumn(border));
|
||||
|
||||
var border2 = treeRoot.FindChildByName("Shifted") as Border;
|
||||
var border2 = treeRoot.FindChild("Shifted") as Border;
|
||||
|
||||
Assert.IsNotNull(border2, "Could not find shifted item to test.");
|
||||
|
||||
|
@ -371,7 +371,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -411,7 +411,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -421,14 +421,14 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
grid.Measure(new Size(1000, 1000));
|
||||
|
||||
var border = treeRoot.FindChildByName("OurItem") as Border;
|
||||
var border = treeRoot.FindChild("OurItem") as Border;
|
||||
|
||||
Assert.IsNotNull(border, "Could not find our item to test.");
|
||||
|
||||
Assert.AreEqual(1, Grid.GetRow(border));
|
||||
Assert.AreEqual(1, Grid.GetColumn(border));
|
||||
|
||||
var border2 = treeRoot.FindChildByName("Shifted") as Border;
|
||||
var border2 = treeRoot.FindChild("Shifted") as Border;
|
||||
|
||||
Assert.IsNotNull(border2, "Could not find shifted item to test.");
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -178,7 +178,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -213,7 +213,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -206,7 +206,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -310,7 +310,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -437,7 +437,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -511,7 +511,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -609,7 +609,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
@ -713,7 +713,7 @@ namespace UnitTests.UI.Controls
|
|||
|
||||
Assert.IsNotNull(treeroot, "Could not load XAML tree.");
|
||||
|
||||
var grid = treeroot.FindChildByName("UniformGrid") as UniformGrid;
|
||||
var grid = treeroot.FindChild("UniformGrid") as UniformGrid;
|
||||
|
||||
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace UnitTests.XamlIslands.UWPApp
|
|||
|
||||
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
|
||||
|
||||
var toolbar = treeRoot.FindChildByName("TextToolbarControl") as TextToolbar;
|
||||
var toolbar = treeRoot.FindChild("TextToolbarControl") as TextToolbar;
|
||||
|
||||
Assert.IsNotNull(toolbar, "Could not find TextToolbar in tree.");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче