Resolving warnings and treating warnings as errors in WinUI project. (#824)

This commit is contained in:
Burak Kaan Köse
2026-02-27 20:12:43 +01:00
committed by GitHub
parent d2fce5eee1
commit 0e742c7a8f
55 changed files with 336 additions and 269 deletions
@@ -6,18 +6,20 @@ namespace Wino.Helpers;
public static class WinoVisualTreeHelper
{
public static T GetChildObject<T>(DependencyObject obj, string name) where T : FrameworkElement
public static T? GetChildObject<T>(DependencyObject? obj, string name) where T : FrameworkElement
{
DependencyObject child = null;
T grandChild = null;
if (obj == null) return null;
DependencyObject? child = null;
T? grandChild = null;
for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
{
child = VisualTreeHelper.GetChild(obj, i);
if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
if (child is T typedChild && (typedChild.Name == name || string.IsNullOrEmpty(name)))
{
return (T)child;
return typedChild;
}
else
{
@@ -31,7 +33,7 @@ public static class WinoVisualTreeHelper
return null;
}
public static IEnumerable<T> FindDescendants<T>(this DependencyObject depObj) where T : DependencyObject
public static IEnumerable<T> FindDescendants<T>(this DependencyObject? depObj) where T : DependencyObject
{
if (depObj != null)
{