[C#/WPF/DEVEXPRESS] BarManager 클래스 : 에디터 포커스 설정하기
■ BarManager 클래스에서 에디터 포커스를 설정하는 방법을 보여준다. ▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" Width="800" Height="600" Title="BarManager 클래스 : 에디터 포커스 설정하기" FontFamily="나눔고딕코딩" FontSize="16"> <Grid> <dxb:BarManager x:Name="barManager" CreateStandardLayout="True"> <dxb:BarManager.Items> <dxb:BarButtonItem x:Name="buttonBarButtonItem" Content="Button" ItemClick="buttonBarButtonItem_ItemClick" /> <dxb:BarEditItem x:Name="textBarEditItem" EditValue="Text"> <dxb:BarEditItem.EditSettings> <dxe:TextEditSettings /> </dxb:BarEditItem.EditSettings> </dxb:BarEditItem> </dxb:BarManager.Items> <dxb:BarManager.Bars> <dxb:Bar x:Name="topBar" Caption="Top Bar"> <dxb:Bar.DockInfo> <dxb:BarDockInfo ContainerType="Top" /> </dxb:Bar.DockInfo> <dxb:Bar.ItemLinks> <dxb:BarButtonItemLink BarItemName="buttonBarButtonItem" /> <dxb:BarEditItemLink BarItemName="textBarEditItem" /> </dxb:Bar.ItemLinks> </dxb:Bar> <dxb:Bar x:Name="leftBar" Caption="Left Bar"> <dxb:Bar.DockInfo> <dxb:BarDockInfo ContainerType="Left" /> </dxb:Bar.DockInfo> <dxb:Bar.ItemLinks> <dxb:BarButtonItemLink BarItemName="buttonBarButtonItem" /> </dxb:Bar.ItemLinks> </dxb:Bar> </dxb:BarManager.Bars> <RichTextBox /> </dxb:BarManager> </Grid> </Window> |
▶ MainWindow.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
using System.Windows; using DevExpress.Xpf.Bars; namespace TestProject { /// <summary> /// 메인 윈도우 /// </summary> public partial class MainWindow : Window { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainWindow() /// <summary> /// 생성자 /// </summary> public MainWindow() { InitializeComponent(); } #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Private #region 버튼 막대 버튼 항목 항목 클릭시 처리하기 - buttonBarButtonItem_ItemClick(sender, e) /// <summary> /// 버튼 막대 버튼 항목 항목 클릭시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void buttonBarButtonItem_ItemClick(object sender, ItemClickEventArgs e) { (this.textBarEditItem.Links[0] as BarEditItemLink).Editor.Focus(); } #endregion } } |
TestProject.zip