Skip to content

Commit

Permalink
Port PersonPicture control from WinUI
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Jan 14, 2020
1 parent ece5abc commit 99523fd
Show file tree
Hide file tree
Showing 27 changed files with 2,437 additions and 8 deletions.
12 changes: 11 additions & 1 deletion ModernWpf.Controls/Common/SharedHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public static Window GetActiveWindow()
}

public static string SafeSubstring(this string s, int startIndex)
{
return s.SafeSubstring(startIndex, s.Length - startIndex);
}

public static string SafeSubstring(this string s, int startIndex, int length)
{
if (s is null)
{
Expand All @@ -130,7 +135,12 @@ public static string SafeSubstring(this string s, int startIndex)
return string.Empty;
}

return s.Substring(startIndex);
if (length > s.Length - startIndex)
{
length = s.Length - startIndex;
}

return s.Substring(startIndex, length);
}

public static bool IndexOf(this UIElementCollection collection, UIElement element, out int index)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override object GetPattern(PatternInterface patternInterface)

protected override string GetClassNameCore()
{
return nameof(DropDownButton);
return typeof(DropDownButton).FullName;
}

private DropDownButton GetImpl()
Expand Down
7 changes: 5 additions & 2 deletions ModernWpf.Controls/NumberBox/NumberBoxAutomationPeer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Windows.Automation;
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using ModernWpf.Controls;
Expand All @@ -23,7 +26,7 @@ public override object GetPattern(PatternInterface patternInterface)

protected override string GetClassNameCore()
{
return nameof(NumberBox);
return typeof(NumberBox).FullName;
}

protected override AutomationControlType GetAutomationControlTypeCore()
Expand Down
Loading

0 comments on commit 99523fd

Please sign in to comment.