-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made MaxLength property consistent across all platforms (#5581)
- Loading branch information
1 parent
ec89cfc
commit 4d9c3a4
Showing
8 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#nullable enable | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace Microsoft.Maui.Platform | ||
{ | ||
public static class MauiAutoSuggestBox | ||
{ | ||
public static void InvalidateAttachedProperties(DependencyObject obj) | ||
{ | ||
OnIsReadOnlyPropertyChanged(obj); | ||
} | ||
|
||
// IsReadOnly | ||
|
||
public static bool GetIsReadOnly(DependencyObject obj) => | ||
(bool)obj.GetValue(IsReadOnlyProperty); | ||
|
||
public static void SetIsReadOnly(DependencyObject obj, bool value) => | ||
obj.SetValue(IsReadOnlyProperty, value); | ||
|
||
public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.RegisterAttached( | ||
"IsReadOnly", typeof(bool), typeof(MauiTextBox), | ||
new PropertyMetadata(true, OnIsReadOnlyPropertyChanged)); | ||
|
||
static void OnIsReadOnlyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs? e = null) | ||
{ | ||
var element = d as FrameworkElement; | ||
var textBox = element?.GetDescendantByName<TextBox>("TextBox"); | ||
if (textBox != null) | ||
textBox.IsReadOnly = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters