11using Microsoft . UI . Xaml ;
22using Microsoft . UI . Xaml . Controls ;
3+ using Microsoft . UI . Xaml . Data ;
34using Microsoft . UI . Xaml . Media ;
45using System . Collections . Generic ;
56using System . Linq ;
@@ -42,6 +43,8 @@ public bool IsDeleteButtonVisible
4243
4344 private ScrollViewer ? ContentElement { get ; set ; }
4445
46+ private TextBox ? InputBox { get ; set ; }
47+
4548 private Button ? DeleteButton { get ; set ; }
4649
4750 private long DeleteButtonPropertyChangedCallbackToken { get ; set ; }
@@ -82,6 +85,21 @@ private void NumberBoxEx_Loaded(object sender, RoutedEventArgs e)
8285 UpdateNumberHorizontalAlignment ( ) ;
8386 }
8487
88+ if ( FindChildrenOfType < TextBox > ( this )
89+ . Where ( x => x . Name == nameof ( InputBox ) )
90+ . FirstOrDefault ( ) is TextBox inputBox )
91+ {
92+ InputBox = inputBox ;
93+ InputBox . SetBinding (
94+ TextBox . MinWidthProperty ,
95+ new Binding
96+ {
97+ Source = this ,
98+ Path = new PropertyPath ( "MinWidth" ) ,
99+ Mode = BindingMode . OneWay ,
100+ } ) ;
101+ }
102+
85103 if ( FindChildrenOfType < Button > ( this )
86104 . Where ( x => x . Name == nameof ( DeleteButton ) )
87105 . FirstOrDefault ( ) is Button deleteButton )
@@ -123,4 +141,4 @@ private void NumberBoxEx_LostFocus(object sender, RoutedEventArgs e)
123141 DeleteButton . Visibility = Visibility . Collapsed ;
124142 }
125143 }
126- }
144+ }
0 commit comments