@@ -25,13 +25,9 @@ public class JsonRPCPluginSettings
2525        private  JsonStorage < ConcurrentDictionary < string ,  object > >  _storage  =  null ! ; 
2626
2727        private  static   readonly  Thickness  SettingPanelMargin  =  ( Thickness ) Application . Current . FindResource ( "SettingPanelMargin" ) ; 
28- 
2928        private  static   readonly  Thickness  SettingPanelItemLeftMargin  =  ( Thickness ) Application . Current . FindResource ( "SettingPanelItemLeftMargin" ) ; 
30-         private  static   readonly  Thickness  SettingPanelItemRightMargin  =  ( Thickness ) Application . Current . FindResource ( "SettingPanelItemRightMargin" ) ; 
3129        private  static   readonly  Thickness  SettingPanelItemTopBottomMargin  =  ( Thickness ) Application . Current . FindResource ( "SettingPanelItemTopBottomMargin" ) ; 
32- 
3330        private  static   readonly  Thickness  SettingPanelItemLeftTopBottomMargin  =  ( Thickness ) Application . Current . FindResource ( "SettingPanelItemLeftTopBottomMargin" ) ; 
34-         private  static   readonly  Thickness  SettingPanelItemRightTopBottomMargin  =  ( Thickness ) Application . Current . FindResource ( "SettingPanelItemRightTopBottomMargin" ) ; 
3531
3632        public  async  Task  InitializeAsync ( ) 
3733        { 
@@ -195,8 +191,9 @@ public void Save()
195191                            contentControl  =  new  TextBlock 
196192                            { 
197193                                Text  =  attributes . Description ? . Replace ( "\\ r\\ n" ,  "\r \n " )  ??  string . Empty , 
198-                                 Margin  =  SettingPanelItemTopBottomMargin , 
199194                                HorizontalAlignment  =  HorizontalAlignment . Left , 
195+                                 VerticalAlignment  =  VerticalAlignment . Center , 
196+                                 Margin  =  SettingPanelItemTopBottomMargin , 
200197                                TextAlignment  =  TextAlignment . Left , 
201198                                TextWrapping  =  TextWrapping . Wrap 
202199                            } ; 
@@ -207,9 +204,11 @@ public void Save()
207204                        { 
208205                            var  textBox  =  new  TextBox ( ) 
209206                            { 
210-                                 Text  =  Settings [ attributes . Name ]  as  string  ??  string . Empty , 
207+                                 MinWidth  =  180 , 
208+                                 HorizontalAlignment  =  HorizontalAlignment . Left , 
209+                                 VerticalAlignment  =  VerticalAlignment . Center , 
211210                                Margin  =  SettingPanelItemLeftTopBottomMargin , 
212-                                 HorizontalAlignment  =  HorizontalAlignment . Stretch , 
211+                                 Text  =  Settings [ attributes . Name ]   as   string   ??   string . Empty , 
213212                                ToolTip  =  attributes . Description 
214213                            } ; 
215214
@@ -227,9 +226,11 @@ public void Save()
227226                        { 
228227                            var  textBox  =  new  TextBox ( ) 
229228                            { 
229+                                 MinWidth  =  240 , 
230+                                 HorizontalAlignment  =  HorizontalAlignment . Left , 
231+                                 VerticalAlignment  =  VerticalAlignment . Center , 
230232                                Margin  =  SettingPanelItemLeftMargin , 
231233                                Text  =  Settings [ attributes . Name ]  as  string  ??  string . Empty , 
232-                                 HorizontalAlignment  =  HorizontalAlignment . Stretch , 
233234                                ToolTip  =  attributes . Description 
234235                            } ; 
235236
@@ -240,6 +241,8 @@ public void Save()
240241
241242                            var  Btn  =  new  Button ( ) 
242243                            { 
244+                                 HorizontalAlignment  =  HorizontalAlignment . Left , 
245+                                 VerticalAlignment  =  VerticalAlignment . Center , 
243246                                Margin  =  SettingPanelItemLeftMargin , 
244247                                Content  =  "Browse"   // TODO: Localization 
245248                            } ; 
@@ -268,16 +271,19 @@ public void Save()
268271                                Settings [ attributes . Name ]  =  path ; 
269272                            } ; 
270273
271-                             var  dockPanel  =  new  DockPanel ( ) 
274+                             var  stackPanel  =  new  StackPanel ( ) 
272275                            { 
273-                                 Margin  =  SettingPanelItemTopBottomMargin 
276+                                 HorizontalAlignment  =  HorizontalAlignment . Left , 
277+                                 VerticalAlignment  =  VerticalAlignment . Center , 
278+                                 Margin  =  SettingPanelItemTopBottomMargin , 
279+                                 Orientation  =  Orientation . Horizontal 
274280                            } ; 
275281
276-                             DockPanel . SetDock ( Btn ,   Dock . Right ) ; 
277-                             dockPanel . Children . Add ( Btn ) ; 
278-                             dockPanel . Children . Add ( textBox ) ; 
282+                             // Create a stack panel to wrap the button and text box 
283+                             stackPanel . Children . Add ( textBox ) ; 
284+                             stackPanel . Children . Add ( Btn ) ; 
279285
280-                             contentControl  =  dockPanel ; 
286+                             contentControl  =  stackPanel ; 
281287
282288                            break ; 
283289                        } 
@@ -286,11 +292,12 @@ public void Save()
286292                            var  textBox  =  new  TextBox ( ) 
287293                            { 
288294                                Height  =  150 , 
289-                                 Margin  =  SettingPanelItemLeftTopBottomMargin , 
295+                                 MinWidth  =  180 , 
296+                                 HorizontalAlignment  =  HorizontalAlignment . Left , 
290297                                VerticalAlignment  =  VerticalAlignment . Center , 
298+                                 Margin  =  SettingPanelItemLeftTopBottomMargin , 
291299                                TextWrapping  =  TextWrapping . WrapWithOverflow , 
292300                                AcceptsReturn  =  true , 
293-                                 HorizontalAlignment  =  HorizontalAlignment . Stretch , 
294301                                Text  =  Settings [ attributes . Name ]  as  string  ??  string . Empty , 
295302                                ToolTip  =  attributes . Description 
296303                            } ; 
@@ -308,10 +315,12 @@ public void Save()
308315                        { 
309316                            var  passwordBox  =  new  PasswordBox ( ) 
310317                            { 
318+                                 MinWidth  =  180 , 
319+                                 HorizontalAlignment  =  HorizontalAlignment . Left , 
320+                                 VerticalAlignment  =  VerticalAlignment . Center , 
311321                                Margin  =  SettingPanelItemLeftTopBottomMargin , 
312322                                Password  =  Settings [ attributes . Name ]  as  string  ??  string . Empty , 
313323                                PasswordChar  =  attributes . passwordChar  ==  default  ?  '*'  :  attributes . passwordChar , 
314-                                 HorizontalAlignment  =  HorizontalAlignment . Stretch , 
315324                                ToolTip  =  attributes . Description 
316325                            } ; 
317326
@@ -330,8 +339,9 @@ public void Save()
330339                            { 
331340                                ItemsSource  =  attributes . Options , 
332341                                SelectedItem  =  Settings [ attributes . Name ] , 
333-                                 Margin  =  SettingPanelItemLeftTopBottomMargin , 
334342                                HorizontalAlignment  =  HorizontalAlignment . Left , 
343+                                 VerticalAlignment  =  VerticalAlignment . Center , 
344+                                 Margin  =  SettingPanelItemLeftTopBottomMargin , 
335345                                ToolTip  =  attributes . Description 
336346                            } ; 
337347
@@ -352,8 +362,9 @@ public void Save()
352362                                Settings [ attributes . Name ]  is  bool  isChecked 
353363                                    ?  isChecked 
354364                                    :  bool . Parse ( attributes . DefaultValue ) , 
355-                                 Margin  =  SettingPanelItemTopBottomMargin , 
356365                                HorizontalAlignment  =  HorizontalAlignment . Left , 
366+                                 VerticalAlignment  =  VerticalAlignment . Center , 
367+                                 Margin  =  SettingPanelItemTopBottomMargin , 
357368                                Content  =  attributes . Label , 
358369                                ToolTip  =  attributes . Description 
359370                            } ; 
@@ -382,17 +393,17 @@ Settings[attributes.Name] is bool isChecked
382393                                e . Handled  =  true ; 
383394                            } ; 
384395
385-                             var  textBlock  =  new  TextBlock ( ) ; 
386-                             textBlock . Inlines . Add ( hyperlink ) ; 
387- 
388-                             var  linkbtn  =  new  Button 
396+                             var  textBlock  =  new  TextBlock ( ) 
389397                            { 
390398                                HorizontalAlignment  =  HorizontalAlignment . Left , 
399+                                 VerticalAlignment  =  VerticalAlignment . Center , 
391400                                Margin  =  SettingPanelItemLeftTopBottomMargin , 
392-                                 Content  =  textBlock 
401+                                 TextAlignment  =  TextAlignment . Left , 
402+                                 TextWrapping  =  TextWrapping . Wrap 
393403                            } ; 
404+                             textBlock . Inlines . Add ( hyperlink ) ; 
394405
395-                             contentControl  =  linkbtn ; 
406+                             contentControl  =  textBlock ; 
396407
397408                            break ; 
398409                        } 
0 commit comments