diff --git a/dev/DevWinUI.Controls/Controls/TextBox.cs b/dev/DevWinUI.Controls/Controls/TextBox.cs new file mode 100644 index 00000000..556e6c3f --- /dev/null +++ b/dev/DevWinUI.Controls/Controls/TextBox.cs @@ -0,0 +1,44 @@ +using Microsoft.UI.Input; +using Microsoft.UI.Xaml.Markup; + +namespace DevWinUI; + +[ContentProperty(Name = nameof(Content))] +public partial class TextBox : Microsoft.UI.Xaml.Controls.TextBox +{ + public object Content + { + get { return (object)GetValue(ContentProperty); } + set { SetValue(ContentProperty, value); } + } + + public static readonly DependencyProperty ContentProperty = + DependencyProperty.Register(nameof(Content), typeof(object), typeof(TextBox), new PropertyMetadata(null, OnContentChanged)); + + private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + var ctl = (TextBox)d; + if (ctl != null ) + { + ctl.UpdateCursor(); + } + } + + private void UpdateCursor() + { + if (Content != null) + { + if (Content is Button button) + { + GeneralHelper.ChangeCursor(button, InputSystemCursor.Create(InputSystemCursorShape.Arrow)); + } + else if (Content is Panel panel) + { + foreach (var item in panel.Children) + { + GeneralHelper.ChangeCursor(item, InputSystemCursor.Create(InputSystemCursorShape.Arrow)); + } + } + } + } +} diff --git a/dev/DevWinUI.Controls/Themes/Generic.xaml b/dev/DevWinUI.Controls/Themes/Generic.xaml index b773647f..1f8b17bf 100644 --- a/dev/DevWinUI.Controls/Themes/Generic.xaml +++ b/dev/DevWinUI.Controls/Themes/Generic.xaml @@ -33,6 +33,7 @@ Themes\Styles\Controls\SelectorBarSegmented.xaml Themes\Styles\Controls\SettingsGroup.xaml Themes\Styles\Controls\Shield.xaml Themes\Styles\Controls\SimpleSettingsGroup.xaml +Themes\Styles\Controls\TextBox.xaml Themes\Styles\Controls\Validation.xaml Themes\Styles\Controls\WaveProgressBar.xaml Themes\Styles\Converters.xaml @@ -276,6 +277,61 @@ Themes\Styles\Win2D\Watermark.xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Visible + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/DevWinUI.Gallery/T4Templates/NavigationPageMappings.cs b/dev/DevWinUI.Gallery/T4Templates/NavigationPageMappings.cs index 523305db..21603850 100644 --- a/dev/DevWinUI.Gallery/T4Templates/NavigationPageMappings.cs +++ b/dev/DevWinUI.Gallery/T4Templates/NavigationPageMappings.cs @@ -25,6 +25,7 @@ public partial class NavigationPageMappings {"DevWinUIGallery.Views.WaveCirclePage", typeof(DevWinUIGallery.Views.WaveCirclePage)}, {"DevWinUIGallery.Views.BubblePage", typeof(DevWinUIGallery.Views.BubblePage)}, {"DevWinUIGallery.Views.GooeyPage", typeof(DevWinUIGallery.Views.GooeyPage)}, + {"DevWinUIGallery.Views.TextBoxPage", typeof(DevWinUIGallery.Views.TextBoxPage)}, {"DevWinUIGallery.Views.TileControlPage", typeof(DevWinUIGallery.Views.TileControlPage)}, {"DevWinUIGallery.Views.PinBoxPage", typeof(DevWinUIGallery.Views.PinBoxPage)}, {"DevWinUIGallery.Views.SelectorBarSegmentedPage", typeof(DevWinUIGallery.Views.SelectorBarSegmentedPage)}, diff --git a/dev/DevWinUI.Gallery/Views/Pages/Features/TextBoxPage.xaml b/dev/DevWinUI.Gallery/Views/Pages/Features/TextBoxPage.xaml new file mode 100644 index 00000000..0221d0cf --- /dev/null +++ b/dev/DevWinUI.Gallery/Views/Pages/Features/TextBoxPage.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + diff --git a/dev/DevWinUI.Gallery/Views/Pages/Features/TextBoxPage.xaml.cs b/dev/DevWinUI.Gallery/Views/Pages/Features/TextBoxPage.xaml.cs new file mode 100644 index 00000000..39a29b1f --- /dev/null +++ b/dev/DevWinUI.Gallery/Views/Pages/Features/TextBoxPage.xaml.cs @@ -0,0 +1,8 @@ +namespace DevWinUIGallery.Views; +public sealed partial class TextBoxPage : Page +{ + public TextBoxPage() + { + this.InitializeComponent(); + } +}