Skip to content

Commit bf823e0

Browse files
committed
Fixed some more leftover references
1 parent b50f3ed commit bf823e0

12 files changed

+48
-48
lines changed

Microsoft.Toolkit.Uwp.SampleApp/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Therefore, for any new control/extension, you should still have a simplified sni
9595
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.
9696

9797
```csharp
98-
var markdownText = control.FindChildByName("MarkdownText") as MarkdownTextBlock;
98+
var markdownText = control.FindChild("MarkdownText") as MarkdownTextBlock;
9999
if (markdownText != null)
100100
{
101101
markdownText.LinkClicked += MarkdownText_LinkClicked;

UnitTests/UnitTests.UWP/Extensions/Test_BitmapIconExtensionMarkupExtension.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void Test_BitmapIconExtension_MarkupExtension_ProvideImage()
3333
</Button>
3434
</Page>") as FrameworkElement;
3535

36-
var button = treeroot.FindChildByName("RootButton") as Button;
36+
var button = treeroot.FindChild("RootButton") as Button;
3737

3838
Assert.IsNotNull(button, $"Could not find the {nameof(Button)} control in tree.");
3939

@@ -66,7 +66,7 @@ public void Test_BitmapIconExtension_MarkupExtension_ProvideImageAndMonochrome()
6666
</Button>
6767
</Page>") as FrameworkElement;
6868

69-
var button = treeroot.FindChildByName("RootButton") as Button;
69+
var button = treeroot.FindChild("RootButton") as Button;
7070

7171
Assert.IsNotNull(button, $"Could not find the {nameof(Button)} control in tree.");
7272

UnitTests/UnitTests.UWP/Extensions/Test_EnumValuesExtension.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void Test_EnumValuesExtension_MarkupExtension()
2727
<ListView x:Name=""Check"" ItemsSource=""{ex:EnumValues Type=local:Animal}""/>
2828
</Page>") as FrameworkElement;
2929

30-
var list = treeRoot.FindChildByName("Check") as ListView;
30+
var list = treeRoot.FindChild("Check") as ListView;
3131

3232
Assert.IsNotNull(list, "Could not find ListView control in tree.");
3333

UnitTests/UnitTests.UWP/Extensions/Test_FontIconExtensionMarkupExtension.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Test_FontIconExtension_MarkupExtension_ProvideSegoeMdl2Asset()
2626
<AppBarButton x:Name=""Check"" Icon=""{ex:FontIcon Glyph=&#xE105;}""/>
2727
</Page>") as FrameworkElement;
2828

29-
var button = treeroot.FindChildByName("Check") as AppBarButton;
29+
var button = treeroot.FindChild("Check") as AppBarButton;
3030

3131
Assert.IsNotNull(button, $"Could not find the {nameof(AppBarButton)} control in tree.");
3232

@@ -49,7 +49,7 @@ public void Test_FontIconExtension_MarkupExtension_ProvideSegoeUI()
4949
<AppBarButton x:Name=""Check"" Icon=""{ex:FontIcon Glyph=&#xE14D;, FontFamily='Segoe UI'}""/>
5050
</Page>") as FrameworkElement;
5151

52-
var button = treeroot.FindChildByName("Check") as AppBarButton;
52+
var button = treeroot.FindChild("Check") as AppBarButton;
5353

5454
Assert.IsNotNull(button, $"Could not find the {nameof(AppBarButton)} control in tree.");
5555

@@ -72,7 +72,7 @@ public void Test_FontIconExtension_MarkupExtension_ProvideCustomFontIcon()
7272
<AppBarButton x:Name=""Check"" Icon=""{ex:FontIcon Glyph=&#xE14D;, FontSize=7, FontFamily='Segoe MDL2 Assets', FontWeight=Bold, FontStyle=Italic, IsTextScaleFactorEnabled=True, MirroredWhenRightToLeft=True}""/>
7373
</Page>") as FrameworkElement;
7474

75-
var button = treeroot.FindChildByName("Check") as AppBarButton;
75+
var button = treeroot.FindChild("Check") as AppBarButton;
7676

7777
Assert.IsNotNull(button, $"Could not find the {nameof(AppBarButton)} control in tree.");
7878

UnitTests/UnitTests.UWP/Extensions/Test_FontIconSourceExtensionMarkupExtension.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Test_FontIconSourceExtension_MarkupExtension_ProvideSegoeMdl2Asset()
2828
<controls:MockSwipeItem x:Name=""Check"" IconSource=""{ex:FontIconSource Glyph=&#xE105;}""/>
2929
</Page>") as FrameworkElement;
3030

31-
var button = treeRoot.FindChildByName("Check") as MockSwipeItem;
31+
var button = treeRoot.FindChild("Check") as MockSwipeItem;
3232

3333
Assert.IsNotNull(button, $"Could not find the {nameof(MockSwipeItem)} control in tree.");
3434

@@ -52,7 +52,7 @@ public void Test_FontIconSourceExtension_MarkupExtension_ProvideSegoeUI()
5252
<controls:MockSwipeItem x:Name=""Check"" IconSource=""{ex:FontIconSource Glyph=&#xE14D;, FontFamily='Segoe UI'}""/>
5353
</Page>") as FrameworkElement;
5454

55-
var button = treeRoot.FindChildByName("Check") as MockSwipeItem;
55+
var button = treeRoot.FindChild("Check") as MockSwipeItem;
5656

5757
Assert.IsNotNull(button, $"Could not find the {nameof(MockSwipeItem)} control in tree.");
5858

@@ -76,7 +76,7 @@ public void Test_FontIconSourceExtension_MarkupExtension_ProvideCustomFontIcon()
7676
<controls:MockSwipeItem x:Name=""Check"" IconSource=""{ex:FontIconSource Glyph=&#xE14D;, FontSize=7, FontFamily='Segoe MDL2 Assets', FontWeight=Bold, FontStyle=Italic, IsTextScaleFactorEnabled=True, MirroredWhenRightToLeft=True}""/>
7777
</Page>") as FrameworkElement;
7878

79-
var button = treeRoot.FindChildByName("Check") as MockSwipeItem;
79+
var button = treeRoot.FindChild("Check") as MockSwipeItem;
8080

8181
Assert.IsNotNull(button, $"Could not find the {nameof(MockSwipeItem)} control in tree.");
8282

UnitTests/UnitTests.UWP/Extensions/Test_NullableBoolMarkupExtension.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Test_NullableBool_MarkupExtension_ProvidesTrue()
2626
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool Value=True}""/>
2727
</Page>") as FrameworkElement;
2828

29-
var toggle = treeroot.FindChildByName("Check") as CheckBox;
29+
var toggle = treeroot.FindChild("Check") as CheckBox;
3030

3131
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
3232

@@ -44,7 +44,7 @@ public void Test_NullableBool_MarkupExtension_ProvidesFalse()
4444
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool Value=False}""/>
4545
</Page>") as FrameworkElement;
4646

47-
var toggle = treeroot.FindChildByName("Check") as CheckBox;
47+
var toggle = treeroot.FindChild("Check") as CheckBox;
4848

4949
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
5050

@@ -62,7 +62,7 @@ public void Test_NullableBool_MarkupExtension_ProvidesNull()
6262
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool IsNull=True}""/>
6363
</Page>") as FrameworkElement;
6464

65-
var toggle = treeroot.FindChildByName("Check") as CheckBox;
65+
var toggle = treeroot.FindChild("Check") as CheckBox;
6666

6767
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
6868

@@ -80,7 +80,7 @@ public void Test_NullableBool_MarkupExtension_ProvidesNullStillWithTrueValue()
8080
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool IsNull=True, Value=True}""/>
8181
</Page>") as FrameworkElement;
8282

83-
var toggle = treeroot.FindChildByName("Check") as CheckBox;
83+
var toggle = treeroot.FindChild("Check") as CheckBox;
8484

8585
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
8686

@@ -99,7 +99,7 @@ public void Test_NullableBool_MarkupExtension_ProvidesNullStillWithFalseValue()
9999
<CheckBox x:Name=""Check"" IsChecked=""{ex:NullableBool IsNull=True, Value=False}""/>
100100
</Page>") as FrameworkElement;
101101

102-
var toggle = treeroot.FindChildByName("Check") as CheckBox;
102+
var toggle = treeroot.FindChild("Check") as CheckBox;
103103

104104
Assert.IsNotNull(toggle, "Could not find checkbox control in tree.");
105105

UnitTests/UnitTests.UWP/UI/Controls/Test_TextToolbar_Localization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void Test_TextToolbar_Localization_Retrieve()
4343

4444
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
4545

46-
var toolbar = treeRoot.FindChildByName("TextToolbarControl") as TextToolbar;
46+
var toolbar = treeRoot.FindChild("TextToolbarControl") as TextToolbar;
4747

4848
Assert.IsNotNull(toolbar, "Could not find TextToolbar in tree.");
4949

UnitTests/UnitTests.UWP/UI/Controls/Test_TokenizingTextBox_General.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void Test_Clear()
3131

3232
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
3333

34-
var tokenBox = treeRoot.FindChildByName("tokenboxname") as TokenizingTextBox;
34+
var tokenBox = treeRoot.FindChild("tokenboxname") as TokenizingTextBox;
3535

3636
Assert.IsNotNull(tokenBox, "Could not find TokenizingTextBox in tree.");
3737

UnitTests/UnitTests.UWP/UI/Controls/Test_UniformGrid_AutoLayout.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void Test_UniformGrid_AutoLayout_FixedElementSingle()
5151

5252
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
5353

54-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
54+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
5555

5656
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
5757

@@ -116,7 +116,7 @@ Otherwise we can't tell it apart from the other items. -->
116116

117117
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
118118

119-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
119+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
120120

121121
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
122122

@@ -176,7 +176,7 @@ public void Test_UniformGrid_AutoLayout_FixedElementSquare()
176176

177177
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
178178

179-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
179+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
180180

181181
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
182182

@@ -222,7 +222,7 @@ public void Test_UniformGrid_AutoLayout_VerticalElement_FixedPosition()
222222

223223
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
224224

225-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
225+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
226226

227227
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
228228

@@ -232,14 +232,14 @@ public void Test_UniformGrid_AutoLayout_VerticalElement_FixedPosition()
232232

233233
grid.Measure(new Size(1000, 1000));
234234

235-
var border = treeRoot.FindChildByName("OurItem") as Border;
235+
var border = treeRoot.FindChild("OurItem") as Border;
236236

237237
Assert.IsNotNull(border, "Could not find our item to test.");
238238

239239
Assert.AreEqual(1, Grid.GetRow(border));
240240
Assert.AreEqual(1, Grid.GetColumn(border));
241241

242-
var border2 = treeRoot.FindChildByName("Shifted") as Border;
242+
var border2 = treeRoot.FindChild("Shifted") as Border;
243243

244244
Assert.IsNotNull(border2, "Could not find shifted item to test.");
245245

@@ -269,7 +269,7 @@ public void Test_UniformGrid_AutoLayout_VerticalElement()
269269

270270
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
271271

272-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
272+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
273273

274274
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
275275

@@ -279,14 +279,14 @@ public void Test_UniformGrid_AutoLayout_VerticalElement()
279279

280280
grid.Measure(new Size(1000, 1000));
281281

282-
var border = treeRoot.FindChildByName("OurItem") as Border;
282+
var border = treeRoot.FindChild("OurItem") as Border;
283283

284284
Assert.IsNotNull(border, "Could not find our item to test.");
285285

286286
Assert.AreEqual(1, Grid.GetRow(border));
287287
Assert.AreEqual(1, Grid.GetColumn(border));
288288

289-
var border2 = treeRoot.FindChildByName("Shifted") as Border;
289+
var border2 = treeRoot.FindChild("Shifted") as Border;
290290

291291
Assert.IsNotNull(border2, "Could not find shifted item to test.");
292292

@@ -316,7 +316,7 @@ public void Test_UniformGrid_AutoLayout_HorizontalElement()
316316

317317
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
318318

319-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
319+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
320320

321321
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
322322

@@ -326,14 +326,14 @@ public void Test_UniformGrid_AutoLayout_HorizontalElement()
326326

327327
grid.Measure(new Size(1000, 1000));
328328

329-
var border = treeRoot.FindChildByName("OurItem") as Border;
329+
var border = treeRoot.FindChild("OurItem") as Border;
330330

331331
Assert.IsNotNull(border, "Could not find our item to test.");
332332

333333
Assert.AreEqual(0, Grid.GetRow(border));
334334
Assert.AreEqual(1, Grid.GetColumn(border));
335335

336-
var border2 = treeRoot.FindChildByName("Shifted") as Border;
336+
var border2 = treeRoot.FindChild("Shifted") as Border;
337337

338338
Assert.IsNotNull(border2, "Could not find shifted item to test.");
339339

@@ -371,7 +371,7 @@ public void Test_UniformGrid_AutoLayout_LargeElement()
371371

372372
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
373373

374-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
374+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
375375

376376
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
377377

@@ -411,7 +411,7 @@ public void Test_UniformGrid_AutoLayout_HorizontalElement_FixedPosition()
411411

412412
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
413413

414-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
414+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
415415

416416
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
417417

@@ -421,14 +421,14 @@ public void Test_UniformGrid_AutoLayout_HorizontalElement_FixedPosition()
421421

422422
grid.Measure(new Size(1000, 1000));
423423

424-
var border = treeRoot.FindChildByName("OurItem") as Border;
424+
var border = treeRoot.FindChild("OurItem") as Border;
425425

426426
Assert.IsNotNull(border, "Could not find our item to test.");
427427

428428
Assert.AreEqual(1, Grid.GetRow(border));
429429
Assert.AreEqual(1, Grid.GetColumn(border));
430430

431-
var border2 = treeRoot.FindChildByName("Shifted") as Border;
431+
var border2 = treeRoot.FindChild("Shifted") as Border;
432432

433433
Assert.IsNotNull(border2, "Could not find shifted item to test.");
434434

UnitTests/UnitTests.UWP/UI/Controls/Test_UniformGrid_Dimensions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void Test_UniformGrid_GetDimensions_NoElements()
2929

3030
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
3131

32-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
32+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
3333

3434
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
3535

@@ -65,7 +65,7 @@ public void Test_UniformGrid_GetDimensions_AllVisible()
6565

6666
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
6767

68-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
68+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
6969

7070
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
7171

@@ -101,7 +101,7 @@ public void Test_UniformGrid_GetDimensions_SomeVisible()
101101

102102
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
103103

104-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
104+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
105105

106106
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
107107

@@ -142,7 +142,7 @@ public void Test_UniformGrid_GetDimensions_FirstColumn()
142142

143143
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
144144

145-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
145+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
146146

147147
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
148148

@@ -178,7 +178,7 @@ public void Test_UniformGrid_GetDimensions_ElementLarger()
178178

179179
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
180180

181-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
181+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
182182

183183
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
184184

@@ -213,7 +213,7 @@ public void Test_UniformGrid_GetDimensions_FirstColumnEqualsColumns()
213213

214214
Assert.IsNotNull(treeRoot, "Could not load XAML tree.");
215215

216-
var grid = treeRoot.FindChildByName("UniformGrid") as UniformGrid;
216+
var grid = treeRoot.FindChild("UniformGrid") as UniformGrid;
217217

218218
Assert.IsNotNull(grid, "Could not find UniformGrid in tree.");
219219

0 commit comments

Comments
 (0)