@@ -25,13 +25,9 @@ public class JsonRPCPluginSettings
25
25
private JsonStorage < ConcurrentDictionary < string , object > > _storage = null ! ;
26
26
27
27
private static readonly Thickness SettingPanelMargin = ( Thickness ) Application . Current . FindResource ( "SettingPanelMargin" ) ;
28
-
29
28
private static readonly Thickness SettingPanelItemLeftMargin = ( Thickness ) Application . Current . FindResource ( "SettingPanelItemLeftMargin" ) ;
30
- private static readonly Thickness SettingPanelItemRightMargin = ( Thickness ) Application . Current . FindResource ( "SettingPanelItemRightMargin" ) ;
31
29
private static readonly Thickness SettingPanelItemTopBottomMargin = ( Thickness ) Application . Current . FindResource ( "SettingPanelItemTopBottomMargin" ) ;
32
-
33
30
private static readonly Thickness SettingPanelItemLeftTopBottomMargin = ( Thickness ) Application . Current . FindResource ( "SettingPanelItemLeftTopBottomMargin" ) ;
34
- private static readonly Thickness SettingPanelItemRightTopBottomMargin = ( Thickness ) Application . Current . FindResource ( "SettingPanelItemRightTopBottomMargin" ) ;
35
31
36
32
public async Task InitializeAsync ( )
37
33
{
@@ -195,8 +191,9 @@ public void Save()
195
191
contentControl = new TextBlock
196
192
{
197
193
Text = attributes . Description ? . Replace ( "\\ r\\ n" , "\r \n " ) ?? string . Empty ,
198
- Margin = SettingPanelItemTopBottomMargin ,
199
194
HorizontalAlignment = HorizontalAlignment . Left ,
195
+ VerticalAlignment = VerticalAlignment . Center ,
196
+ Margin = SettingPanelItemTopBottomMargin ,
200
197
TextAlignment = TextAlignment . Left ,
201
198
TextWrapping = TextWrapping . Wrap
202
199
} ;
@@ -207,9 +204,11 @@ public void Save()
207
204
{
208
205
var textBox = new TextBox ( )
209
206
{
210
- Text = Settings [ attributes . Name ] as string ?? string . Empty ,
207
+ MinWidth = 180 ,
208
+ HorizontalAlignment = HorizontalAlignment . Left ,
209
+ VerticalAlignment = VerticalAlignment . Center ,
211
210
Margin = SettingPanelItemLeftTopBottomMargin ,
212
- HorizontalAlignment = HorizontalAlignment . Stretch ,
211
+ Text = Settings [ attributes . Name ] as string ?? string . Empty ,
213
212
ToolTip = attributes . Description
214
213
} ;
215
214
@@ -227,9 +226,11 @@ public void Save()
227
226
{
228
227
var textBox = new TextBox ( )
229
228
{
229
+ MinWidth = 240 ,
230
+ HorizontalAlignment = HorizontalAlignment . Left ,
231
+ VerticalAlignment = VerticalAlignment . Center ,
230
232
Margin = SettingPanelItemLeftMargin ,
231
233
Text = Settings [ attributes . Name ] as string ?? string . Empty ,
232
- HorizontalAlignment = HorizontalAlignment . Stretch ,
233
234
ToolTip = attributes . Description
234
235
} ;
235
236
@@ -240,6 +241,8 @@ public void Save()
240
241
241
242
var Btn = new Button ( )
242
243
{
244
+ HorizontalAlignment = HorizontalAlignment . Left ,
245
+ VerticalAlignment = VerticalAlignment . Center ,
243
246
Margin = SettingPanelItemLeftMargin ,
244
247
Content = "Browse" // TODO: Localization
245
248
} ;
@@ -268,16 +271,19 @@ public void Save()
268
271
Settings [ attributes . Name ] = path ;
269
272
} ;
270
273
271
- var dockPanel = new DockPanel ( )
274
+ var stackPanel = new StackPanel ( )
272
275
{
273
- Margin = SettingPanelItemTopBottomMargin
276
+ HorizontalAlignment = HorizontalAlignment . Left ,
277
+ VerticalAlignment = VerticalAlignment . Center ,
278
+ Margin = SettingPanelItemTopBottomMargin ,
279
+ Orientation = Orientation . Horizontal
274
280
} ;
275
281
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 ) ;
279
285
280
- contentControl = dockPanel ;
286
+ contentControl = stackPanel ;
281
287
282
288
break ;
283
289
}
@@ -286,11 +292,12 @@ public void Save()
286
292
var textBox = new TextBox ( )
287
293
{
288
294
Height = 150 ,
289
- Margin = SettingPanelItemLeftTopBottomMargin ,
295
+ MinWidth = 180 ,
296
+ HorizontalAlignment = HorizontalAlignment . Left ,
290
297
VerticalAlignment = VerticalAlignment . Center ,
298
+ Margin = SettingPanelItemLeftTopBottomMargin ,
291
299
TextWrapping = TextWrapping . WrapWithOverflow ,
292
300
AcceptsReturn = true ,
293
- HorizontalAlignment = HorizontalAlignment . Stretch ,
294
301
Text = Settings [ attributes . Name ] as string ?? string . Empty ,
295
302
ToolTip = attributes . Description
296
303
} ;
@@ -308,10 +315,12 @@ public void Save()
308
315
{
309
316
var passwordBox = new PasswordBox ( )
310
317
{
318
+ MinWidth = 180 ,
319
+ HorizontalAlignment = HorizontalAlignment . Left ,
320
+ VerticalAlignment = VerticalAlignment . Center ,
311
321
Margin = SettingPanelItemLeftTopBottomMargin ,
312
322
Password = Settings [ attributes . Name ] as string ?? string . Empty ,
313
323
PasswordChar = attributes . passwordChar == default ? '*' : attributes . passwordChar ,
314
- HorizontalAlignment = HorizontalAlignment . Stretch ,
315
324
ToolTip = attributes . Description
316
325
} ;
317
326
@@ -330,8 +339,9 @@ public void Save()
330
339
{
331
340
ItemsSource = attributes . Options ,
332
341
SelectedItem = Settings [ attributes . Name ] ,
333
- Margin = SettingPanelItemLeftTopBottomMargin ,
334
342
HorizontalAlignment = HorizontalAlignment . Left ,
343
+ VerticalAlignment = VerticalAlignment . Center ,
344
+ Margin = SettingPanelItemLeftTopBottomMargin ,
335
345
ToolTip = attributes . Description
336
346
} ;
337
347
@@ -352,8 +362,9 @@ public void Save()
352
362
Settings [ attributes . Name ] is bool isChecked
353
363
? isChecked
354
364
: bool . Parse ( attributes . DefaultValue ) ,
355
- Margin = SettingPanelItemTopBottomMargin ,
356
365
HorizontalAlignment = HorizontalAlignment . Left ,
366
+ VerticalAlignment = VerticalAlignment . Center ,
367
+ Margin = SettingPanelItemTopBottomMargin ,
357
368
Content = attributes . Label ,
358
369
ToolTip = attributes . Description
359
370
} ;
@@ -382,17 +393,17 @@ Settings[attributes.Name] is bool isChecked
382
393
e . Handled = true ;
383
394
} ;
384
395
385
- var textBlock = new TextBlock ( ) ;
386
- textBlock . Inlines . Add ( hyperlink ) ;
387
-
388
- var linkbtn = new Button
396
+ var textBlock = new TextBlock ( )
389
397
{
390
398
HorizontalAlignment = HorizontalAlignment . Left ,
399
+ VerticalAlignment = VerticalAlignment . Center ,
391
400
Margin = SettingPanelItemLeftTopBottomMargin ,
392
- Content = textBlock
401
+ TextAlignment = TextAlignment . Left ,
402
+ TextWrapping = TextWrapping . Wrap
393
403
} ;
404
+ textBlock . Inlines . Add ( hyperlink ) ;
394
405
395
- contentControl = linkbtn ;
406
+ contentControl = textBlock ;
396
407
397
408
break ;
398
409
}
0 commit comments