TextBoxTests.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. using System;
  2. using System.Reactive.Linq;
  3. using System.Threading.Tasks;
  4. using Avalonia.Controls.Presenters;
  5. using Avalonia.Controls.Primitives;
  6. using Avalonia.Controls.Templates;
  7. using Avalonia.Data;
  8. using Avalonia.Input;
  9. using Avalonia.Input.Platform;
  10. using Avalonia.Media;
  11. using Avalonia.Platform;
  12. using Avalonia.UnitTests;
  13. using Moq;
  14. using Xunit;
  15. namespace Avalonia.Controls.UnitTests
  16. {
  17. public class TextBoxTests
  18. {
  19. [Fact]
  20. public void Opening_Context_Menu_Does_not_Lose_Selection()
  21. {
  22. using (UnitTestApplication.Start(FocusServices))
  23. {
  24. var target1 = new TextBox
  25. {
  26. Template = CreateTemplate(),
  27. Text = "1234",
  28. ContextMenu = new TestContextMenu()
  29. };
  30. var target2 = new TextBox
  31. {
  32. Template = CreateTemplate(),
  33. Text = "5678"
  34. };
  35. var sp = new StackPanel();
  36. sp.Children.Add(target1);
  37. sp.Children.Add(target2);
  38. target1.ApplyTemplate();
  39. target2.ApplyTemplate();
  40. var root = new TestRoot() { Child = sp };
  41. target1.SelectionStart = 0;
  42. target1.SelectionEnd = 3;
  43. target1.Focus();
  44. Assert.False(target2.IsFocused);
  45. Assert.True(target1.IsFocused);
  46. target2.Focus();
  47. Assert.Equal("123", target1.SelectedText);
  48. }
  49. }
  50. [Fact]
  51. public void DefaultBindingMode_Should_Be_TwoWay()
  52. {
  53. Assert.Equal(
  54. BindingMode.TwoWay,
  55. TextBox.TextProperty.GetMetadata(typeof(TextBox)).DefaultBindingMode);
  56. }
  57. [Fact]
  58. public void CaretIndex_Can_Moved_To_Position_After_The_End_Of_Text_With_Arrow_Key()
  59. {
  60. using (UnitTestApplication.Start(Services))
  61. {
  62. var target = new TextBox
  63. {
  64. Template = CreateTemplate(),
  65. Text = "1234"
  66. };
  67. target.CaretIndex = 3;
  68. RaiseKeyEvent(target, Key.Right, 0);
  69. Assert.Equal(4, target.CaretIndex);
  70. }
  71. }
  72. [Fact]
  73. public void Press_Ctrl_A_Select_All_Text()
  74. {
  75. using (UnitTestApplication.Start(Services))
  76. {
  77. var target = new TextBox
  78. {
  79. Template = CreateTemplate(),
  80. Text = "1234"
  81. };
  82. RaiseKeyEvent(target, Key.A, KeyModifiers.Control);
  83. Assert.Equal(0, target.SelectionStart);
  84. Assert.Equal(4, target.SelectionEnd);
  85. }
  86. }
  87. [Fact]
  88. public void Press_Ctrl_A_Select_All_Null_Text()
  89. {
  90. using (UnitTestApplication.Start(Services))
  91. {
  92. var target = new TextBox
  93. {
  94. Template = CreateTemplate()
  95. };
  96. RaiseKeyEvent(target, Key.A, KeyModifiers.Control);
  97. Assert.Equal(0, target.SelectionStart);
  98. Assert.Equal(0, target.SelectionEnd);
  99. }
  100. }
  101. [Fact]
  102. public void Press_Ctrl_Z_Will_Not_Modify_Text()
  103. {
  104. using (UnitTestApplication.Start(Services))
  105. {
  106. var target = new TextBox
  107. {
  108. Template = CreateTemplate(),
  109. Text = "1234"
  110. };
  111. RaiseKeyEvent(target, Key.Z, KeyModifiers.Control);
  112. Assert.Equal("1234", target.Text);
  113. }
  114. }
  115. [Fact]
  116. public void Typing_Beginning_With_0_Should_Not_Modify_Text_When_Bound_To_Int()
  117. {
  118. using (UnitTestApplication.Start(Services))
  119. {
  120. var source = new Class1();
  121. var target = new TextBox
  122. {
  123. DataContext = source,
  124. Template = CreateTemplate(),
  125. };
  126. target.ApplyTemplate();
  127. target.Bind(TextBox.TextProperty, new Binding(nameof(Class1.Foo), BindingMode.TwoWay));
  128. Assert.Equal("0", target.Text);
  129. target.CaretIndex = 1;
  130. target.RaiseEvent(new TextInputEventArgs
  131. {
  132. RoutedEvent = InputElement.TextInputEvent,
  133. Text = "2",
  134. });
  135. Assert.Equal("02", target.Text);
  136. }
  137. }
  138. [Fact]
  139. public void Control_Backspace_Should_Remove_The_Word_Before_The_Caret_If_There_Is_No_Selection()
  140. {
  141. using (UnitTestApplication.Start(Services))
  142. {
  143. TextBox textBox = new TextBox
  144. {
  145. Text = "First Second Third Fourth",
  146. CaretIndex = 5
  147. };
  148. // (First| Second Third Fourth)
  149. RaiseKeyEvent(textBox, Key.Back, KeyModifiers.Control);
  150. Assert.Equal(" Second Third Fourth", textBox.Text);
  151. // ( Second |Third Fourth)
  152. textBox.CaretIndex = 8;
  153. RaiseKeyEvent(textBox, Key.Back, KeyModifiers.Control);
  154. Assert.Equal(" Third Fourth", textBox.Text);
  155. // ( Thi|rd Fourth)
  156. textBox.CaretIndex = 4;
  157. RaiseKeyEvent(textBox, Key.Back, KeyModifiers.Control);
  158. Assert.Equal(" rd Fourth", textBox.Text);
  159. // ( rd F[ou]rth)
  160. textBox.SelectionStart = 5;
  161. textBox.SelectionEnd = 7;
  162. RaiseKeyEvent(textBox, Key.Back, KeyModifiers.Control);
  163. Assert.Equal(" rd Frth", textBox.Text);
  164. // ( |rd Frth)
  165. textBox.CaretIndex = 1;
  166. RaiseKeyEvent(textBox, Key.Back, KeyModifiers.Control);
  167. Assert.Equal("rd Frth", textBox.Text);
  168. }
  169. }
  170. [Fact]
  171. public void Control_Delete_Should_Remove_The_Word_After_The_Caret_If_There_Is_No_Selection()
  172. {
  173. using (UnitTestApplication.Start(Services))
  174. {
  175. TextBox textBox = new TextBox
  176. {
  177. Text = "First Second Third Fourth",
  178. CaretIndex = 19
  179. };
  180. // (First Second Third |Fourth)
  181. RaiseKeyEvent(textBox, Key.Delete, KeyModifiers.Control);
  182. Assert.Equal("First Second Third ", textBox.Text);
  183. // (First Second |Third )
  184. textBox.CaretIndex = 13;
  185. RaiseKeyEvent(textBox, Key.Delete, KeyModifiers.Control);
  186. Assert.Equal("First Second ", textBox.Text);
  187. // (First Sec|ond )
  188. textBox.CaretIndex = 9;
  189. RaiseKeyEvent(textBox, Key.Delete, KeyModifiers.Control);
  190. Assert.Equal("First Sec", textBox.Text);
  191. // (Fi[rs]t Sec )
  192. textBox.SelectionStart = 2;
  193. textBox.SelectionEnd = 4;
  194. RaiseKeyEvent(textBox, Key.Delete, KeyModifiers.Control);
  195. Assert.Equal("Fit Sec", textBox.Text);
  196. // (Fit Sec| )
  197. textBox.Text += " ";
  198. textBox.CaretIndex = 7;
  199. RaiseKeyEvent(textBox, Key.Delete, KeyModifiers.Control);
  200. Assert.Equal("Fit Sec", textBox.Text);
  201. }
  202. }
  203. [Fact]
  204. public void Setting_SelectionStart_To_SelectionEnd_Sets_CaretPosition_To_SelectionStart()
  205. {
  206. using (UnitTestApplication.Start(Services))
  207. {
  208. var textBox = new TextBox
  209. {
  210. Text = "0123456789"
  211. };
  212. textBox.SelectionStart = 2;
  213. textBox.SelectionEnd = 2;
  214. Assert.Equal(2, textBox.CaretIndex);
  215. }
  216. }
  217. [Fact]
  218. public void Setting_Text_Updates_CaretPosition()
  219. {
  220. using (UnitTestApplication.Start(Services))
  221. {
  222. var target = new TextBox
  223. {
  224. Text = "Initial Text",
  225. CaretIndex = 11
  226. };
  227. var invoked = false;
  228. target.GetObservable(TextBox.TextProperty).Skip(1).Subscribe(_ =>
  229. {
  230. // Caret index should be set before Text changed notification, as we don't want
  231. // to notify with an invalid CaretIndex.
  232. Assert.Equal(7, target.CaretIndex);
  233. invoked = true;
  234. });
  235. target.Text = "Changed";
  236. Assert.True(invoked);
  237. }
  238. }
  239. [Fact]
  240. public void Press_Enter_Does_Not_Accept_Return()
  241. {
  242. using (UnitTestApplication.Start(Services))
  243. {
  244. var target = new TextBox
  245. {
  246. Template = CreateTemplate(),
  247. AcceptsReturn = false,
  248. Text = "1234"
  249. };
  250. RaiseKeyEvent(target, Key.Enter, 0);
  251. Assert.Equal("1234", target.Text);
  252. }
  253. }
  254. [Fact]
  255. public void Press_Enter_Add_Default_Newline()
  256. {
  257. using (UnitTestApplication.Start(Services))
  258. {
  259. var target = new TextBox
  260. {
  261. Template = CreateTemplate(),
  262. AcceptsReturn = true
  263. };
  264. RaiseKeyEvent(target, Key.Enter, 0);
  265. Assert.Equal(Environment.NewLine, target.Text);
  266. }
  267. }
  268. [Fact]
  269. public void Press_Enter_Add_Custom_Newline()
  270. {
  271. using (UnitTestApplication.Start(Services))
  272. {
  273. var target = new TextBox
  274. {
  275. Template = CreateTemplate(),
  276. AcceptsReturn = true,
  277. NewLine = "Test"
  278. };
  279. RaiseKeyEvent(target, Key.Enter, 0);
  280. Assert.Equal("Test", target.Text);
  281. }
  282. }
  283. [Theory]
  284. [InlineData(new object[] { false, TextWrapping.NoWrap, ScrollBarVisibility.Hidden })]
  285. [InlineData(new object[] { false, TextWrapping.Wrap, ScrollBarVisibility.Hidden })]
  286. [InlineData(new object[] { true, TextWrapping.NoWrap, ScrollBarVisibility.Auto })]
  287. [InlineData(new object[] { true, TextWrapping.Wrap, ScrollBarVisibility.Disabled })]
  288. public void Has_Correct_Horizontal_ScrollBar_Visibility(
  289. bool acceptsReturn,
  290. TextWrapping wrapping,
  291. ScrollBarVisibility expected)
  292. {
  293. using (UnitTestApplication.Start(Services))
  294. {
  295. var target = new TextBox
  296. {
  297. AcceptsReturn = acceptsReturn,
  298. TextWrapping = wrapping,
  299. };
  300. Assert.Equal(expected, ScrollViewer.GetHorizontalScrollBarVisibility(target));
  301. }
  302. }
  303. [Fact]
  304. public void SelectionEnd_Doesnt_Cause_Exception()
  305. {
  306. using (UnitTestApplication.Start(Services))
  307. {
  308. var target = new TextBox
  309. {
  310. Template = CreateTemplate(),
  311. Text = "0123456789"
  312. };
  313. target.SelectionStart = 0;
  314. target.SelectionEnd = 9;
  315. target.Text = "123";
  316. RaiseTextEvent(target, "456");
  317. Assert.True(true);
  318. }
  319. }
  320. [Fact]
  321. public void SelectionStart_Doesnt_Cause_Exception()
  322. {
  323. using (UnitTestApplication.Start(Services))
  324. {
  325. var target = new TextBox
  326. {
  327. Template = CreateTemplate(),
  328. Text = "0123456789"
  329. };
  330. target.SelectionStart = 8;
  331. target.SelectionEnd = 9;
  332. target.Text = "123";
  333. RaiseTextEvent(target, "456");
  334. Assert.True(true);
  335. }
  336. }
  337. [Fact]
  338. public void SelectionStartEnd_Are_Valid_AterTextChange()
  339. {
  340. using (UnitTestApplication.Start(Services))
  341. {
  342. var target = new TextBox
  343. {
  344. Template = CreateTemplate(),
  345. Text = "0123456789"
  346. };
  347. target.SelectionStart = 8;
  348. target.SelectionEnd = 9;
  349. target.Text = "123";
  350. Assert.True(target.SelectionStart <= "123".Length);
  351. Assert.True(target.SelectionEnd <= "123".Length);
  352. }
  353. }
  354. [Fact]
  355. public void SelectedText_Changes_OnSelectionChange()
  356. {
  357. using (UnitTestApplication.Start(Services))
  358. {
  359. var target = new TextBox
  360. {
  361. Template = CreateTemplate(),
  362. Text = "0123456789"
  363. };
  364. Assert.True(target.SelectedText == "");
  365. target.SelectionStart = 2;
  366. target.SelectionEnd = 4;
  367. Assert.True(target.SelectedText == "23");
  368. }
  369. }
  370. [Fact]
  371. public void SelectedText_EditsText()
  372. {
  373. using (UnitTestApplication.Start(Services))
  374. {
  375. var target = new TextBox
  376. {
  377. Template = CreateTemplate(),
  378. Text = "0123"
  379. };
  380. target.SelectedText = "AA";
  381. Assert.True(target.Text == "AA0123");
  382. target.SelectionStart = 1;
  383. target.SelectionEnd = 3;
  384. target.SelectedText = "BB";
  385. Assert.True(target.Text == "ABB123");
  386. }
  387. }
  388. [Fact]
  389. public void SelectedText_CanClearText()
  390. {
  391. using (UnitTestApplication.Start(Services))
  392. {
  393. var target = new TextBox
  394. {
  395. Template = CreateTemplate(),
  396. Text = "0123"
  397. };
  398. target.SelectionStart = 1;
  399. target.SelectionEnd = 3;
  400. target.SelectedText = "";
  401. Assert.True(target.Text == "03");
  402. }
  403. }
  404. [Fact]
  405. public void SelectedText_NullClearsText()
  406. {
  407. using (UnitTestApplication.Start(Services))
  408. {
  409. var target = new TextBox
  410. {
  411. Template = CreateTemplate(),
  412. Text = "0123"
  413. };
  414. target.SelectionStart = 1;
  415. target.SelectionEnd = 3;
  416. target.SelectedText = null;
  417. Assert.True(target.Text == "03");
  418. }
  419. }
  420. [Fact]
  421. public void CoerceCaretIndex_Doesnt_Cause_Exception_with_malformed_line_ending()
  422. {
  423. using (UnitTestApplication.Start(Services))
  424. {
  425. var target = new TextBox
  426. {
  427. Template = CreateTemplate(),
  428. Text = "0123456789\r"
  429. };
  430. target.CaretIndex = 11;
  431. Assert.True(true);
  432. }
  433. }
  434. [Fact]
  435. public void TextBox_GotFocus_And_LostFocus_Work_Properly()
  436. {
  437. using (UnitTestApplication.Start(FocusServices))
  438. {
  439. var target1 = new TextBox
  440. {
  441. Template = CreateTemplate(),
  442. Text = "1234"
  443. };
  444. var target2 = new TextBox
  445. {
  446. Template = CreateTemplate(),
  447. Text = "5678"
  448. };
  449. var sp = new StackPanel();
  450. sp.Children.Add(target1);
  451. sp.Children.Add(target2);
  452. target1.ApplyTemplate();
  453. target2.ApplyTemplate();
  454. var root = new TestRoot { Child = sp };
  455. var gfcount = 0;
  456. var lfcount = 0;
  457. target1.GotFocus += (s, e) => gfcount++;
  458. target2.LostFocus += (s, e) => lfcount++;
  459. target2.Focus();
  460. Assert.False(target1.IsFocused);
  461. Assert.True(target2.IsFocused);
  462. target1.Focus();
  463. Assert.False(target2.IsFocused);
  464. Assert.True(target1.IsFocused);
  465. Assert.Equal(1, gfcount);
  466. Assert.Equal(1, lfcount);
  467. }
  468. }
  469. [Fact]
  470. public void TextBox_CaretIndex_Persists_When_Focus_Lost()
  471. {
  472. using (UnitTestApplication.Start(FocusServices))
  473. {
  474. var target1 = new TextBox
  475. {
  476. Template = CreateTemplate(),
  477. Text = "1234"
  478. };
  479. var target2 = new TextBox
  480. {
  481. Template = CreateTemplate(),
  482. Text = "5678"
  483. };
  484. var sp = new StackPanel();
  485. sp.Children.Add(target1);
  486. sp.Children.Add(target2);
  487. target1.ApplyTemplate();
  488. target2.ApplyTemplate();
  489. var root = new TestRoot { Child = sp };
  490. target2.Focus();
  491. target2.CaretIndex = 2;
  492. Assert.False(target1.IsFocused);
  493. Assert.True(target2.IsFocused);
  494. target1.Focus();
  495. Assert.Equal(2, target2.CaretIndex);
  496. }
  497. }
  498. [Fact]
  499. public void TextBox_Reveal_Password_Reset_When_Lost_Focus()
  500. {
  501. using (UnitTestApplication.Start(FocusServices))
  502. {
  503. var target1 = new TextBox
  504. {
  505. Template = CreateTemplate(),
  506. Text = "1234",
  507. PasswordChar = '*'
  508. };
  509. var target2 = new TextBox
  510. {
  511. Template = CreateTemplate(),
  512. Text = "5678"
  513. };
  514. var sp = new StackPanel();
  515. sp.Children.Add(target1);
  516. sp.Children.Add(target2);
  517. target1.ApplyTemplate();
  518. target2.ApplyTemplate();
  519. var root = new TestRoot { Child = sp };
  520. target1.Focus();
  521. target1.RevealPassword = true;
  522. target2.Focus();
  523. Assert.False(target1.RevealPassword);
  524. }
  525. }
  526. [Fact]
  527. public void Setting_Bound_Text_To_Null_Works()
  528. {
  529. using (UnitTestApplication.Start(Services))
  530. {
  531. var source = new Class1 { Bar = "bar" };
  532. var target = new TextBox { DataContext = source };
  533. target.Bind(TextBox.TextProperty, new Binding("Bar"));
  534. Assert.Equal("bar", target.Text);
  535. source.Bar = null;
  536. Assert.Null(target.Text);
  537. }
  538. }
  539. [Fact]
  540. public void Text_Box_MaxLength_Work_Properly()
  541. {
  542. using (UnitTestApplication.Start(Services))
  543. {
  544. var target = new TextBox
  545. {
  546. Template = CreateTemplate(),
  547. Text = "abc",
  548. MaxLength = 3,
  549. };
  550. RaiseKeyEvent(target, Key.D, KeyModifiers.None);
  551. Assert.Equal("abc", target.Text);
  552. }
  553. }
  554. [Theory]
  555. [InlineData(Key.X, KeyModifiers.Control)]
  556. [InlineData(Key.Back, KeyModifiers.None)]
  557. [InlineData(Key.Delete, KeyModifiers.None)]
  558. [InlineData(Key.Tab, KeyModifiers.None)]
  559. [InlineData(Key.Enter, KeyModifiers.None)]
  560. public void Keys_Allow_Undo(Key key, KeyModifiers modifiers)
  561. {
  562. using (UnitTestApplication.Start(Services))
  563. {
  564. var target = new TextBox
  565. {
  566. Template = CreateTemplate(),
  567. Text = "0123",
  568. AcceptsReturn = true,
  569. AcceptsTab = true
  570. };
  571. target.SelectionStart = 1;
  572. target.SelectionEnd = 3;
  573. AvaloniaLocator.CurrentMutable
  574. .Bind<Input.Platform.IClipboard>().ToSingleton<ClipboardStub>();
  575. RaiseKeyEvent(target, key, modifiers);
  576. RaiseKeyEvent(target, Key.Z, KeyModifiers.Control); // undo
  577. Assert.True(target.Text == "0123");
  578. }
  579. }
  580. private static TestServices FocusServices => TestServices.MockThreadingInterface.With(
  581. focusManager: new FocusManager(),
  582. keyboardDevice: () => new KeyboardDevice(),
  583. keyboardNavigation: new KeyboardNavigationHandler(),
  584. inputManager: new InputManager(),
  585. standardCursorFactory: Mock.Of<IStandardCursorFactory>());
  586. private static TestServices Services => TestServices.MockThreadingInterface.With(
  587. standardCursorFactory: Mock.Of<IStandardCursorFactory>());
  588. private IControlTemplate CreateTemplate()
  589. {
  590. return new FuncControlTemplate<TextBox>((control, scope) =>
  591. new TextPresenter
  592. {
  593. Name = "PART_TextPresenter",
  594. [!!TextPresenter.TextProperty] = new Binding
  595. {
  596. Path = "Text",
  597. Mode = BindingMode.TwoWay,
  598. Priority = BindingPriority.TemplatedParent,
  599. RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent),
  600. },
  601. }.RegisterInNameScope(scope));
  602. }
  603. private void RaiseKeyEvent(TextBox textBox, Key key, KeyModifiers inputModifiers)
  604. {
  605. textBox.RaiseEvent(new KeyEventArgs
  606. {
  607. RoutedEvent = InputElement.KeyDownEvent,
  608. KeyModifiers = inputModifiers,
  609. Key = key
  610. });
  611. }
  612. private void RaiseTextEvent(TextBox textBox, string text)
  613. {
  614. textBox.RaiseEvent(new TextInputEventArgs
  615. {
  616. RoutedEvent = InputElement.TextInputEvent,
  617. Text = text
  618. });
  619. }
  620. private class Class1 : NotifyingBase
  621. {
  622. private int _foo;
  623. private string _bar;
  624. public int Foo
  625. {
  626. get { return _foo; }
  627. set { _foo = value; RaisePropertyChanged(); }
  628. }
  629. public string Bar
  630. {
  631. get { return _bar; }
  632. set { _bar = value; RaisePropertyChanged(); }
  633. }
  634. }
  635. private class ClipboardStub : IClipboard // in order to get tests working that use the clipboard
  636. {
  637. public Task<string> GetTextAsync() => Task.FromResult("");
  638. public Task SetTextAsync(string text) => Task.CompletedTask;
  639. public Task ClearAsync() => Task.CompletedTask;
  640. public Task SetDataObjectAsync(IDataObject data) => Task.CompletedTask;
  641. public Task<string[]> GetFormatsAsync() => Task.FromResult(Array.Empty<string>());
  642. public Task<object> GetDataAsync(string format) => Task.FromResult((object)null);
  643. }
  644. private class TestContextMenu : ContextMenu
  645. {
  646. public TestContextMenu()
  647. {
  648. IsOpen = true;
  649. }
  650. }
  651. }
  652. }