Esempio n. 1
0
        void AddFormatMenu(Menu menu)
        {
            // top level menu Format
            MenuItem itemFormat = new MenuItem()
            {
                Header = "_Format"
            };

            menu.Items.Add(itemFormat);

            // command WordWrap
            WordWrapMenuItem itemWrap = new WordWrapMenuItem();

            itemFormat.Items.Add(itemWrap);

            // bind to TextBox
            Binding bind = new Binding()
            {
                Path   = new PropertyPath(TextBox.TextWrappingProperty),
                Source = txtbox,
                Mode   = BindingMode.TwoWay
            };

            itemWrap.SetBinding(WordWrapMenuItem.WordWrapProperty, bind);

            // command Font
            MenuItem itemFont = new MenuItem()
            {
                Header = "_Font..."
            };

            itemFont.Click += FontOnClick;
            itemFormat.Items.Add(itemFont);
        }
Esempio n. 2
0
        void AddFormatMenu(Menu menu)
        {
            //탑 레벨 Format 항목 생성
            MenuItem itemFormat = new MenuItem();
            itemFormat.Header = "F_ormat";
            menu.Items.Add(itemFormat);

            //자동 줄바꿈 메뉴 항목 생성
            WordWrapMenuItem itemWrap = new WordWrapMenuItem();
            itemFormat.Items.Add(itemWrap);

            //TextWrapping 프로퍼티 항목과 텍스트 박스를 바인딩

            //TextWrapping 프로퍼티와 WordWramenuItem의 WordWrap프로퍼티를 바인딩하기 위해 Binding 객체 생성.
            Binding bind = new Binding();
            bind.Path = new PropertyPath(TextBox.TextWrappingProperty);
            // 데이터 소스 설정.
            bind.Source = txtbox;
            //바인팅 모드 : 타킷도 소스에 반영할수 있도록 TwoWay 설정.
            bind.Mode = BindingMode.TwoWay;
            //TextBox의 SetBinding 메소드를 호출.
            itemWrap.SetBinding(WordWrapMenuItem.WordWrapProperty, bind);

            //Font 메뉴 항목생성
            MenuItem itemFont = new MenuItem();
            itemFont.Header = "_Font...";
            itemFont.Click +=FontOnClick;
            itemFormat.Items.Add(itemFont);
        }
Esempio n. 3
0
        void AddFormatMenu(Menu menu)
        {
            // Create top-level Format item.
            MenuItem itemFormat = new MenuItem();

            itemFormat.Header = "F_ormat";
            menu.Items.Add(itemFormat);

            // Create Word Wrap menu item.
            WordWrapMenuItem itemWrap = new WordWrapMenuItem();

            itemFormat.Items.Add(itemWrap);

            // Bind item to TextWrapping property of TextBox.
            Binding bind = new Binding();

            bind.Path   = new PropertyPath(TextBox.TextWrappingProperty);
            bind.Source = txtbox;
            bind.Mode   = BindingMode.TwoWay;
            itemWrap.SetBinding(WordWrapMenuItem.WordWrapProperty, bind);

            // Create Font menu item.
            MenuItem itemFont = new MenuItem();

            itemFont.Header = "_Font...";
            itemFont.Click += FontOnClick;
            itemFormat.Items.Add(itemFont);
        }
        void AddFormatMenu(Menu menu)
        {
            // Create top-level Format item.
            MenuItem itemFormat = new MenuItem();
            itemFormat.Header = "F_ormat";
            menu.Items.Add(itemFormat);

            // Create Word Wrap menu item.
            WordWrapMenuItem itemWrap = new WordWrapMenuItem();
            itemFormat.Items.Add(itemWrap);

            // Bind item to TextWrapping property of TextBox.
            Binding bind = new Binding();
            bind.Path = new PropertyPath(TextBox.TextWrappingProperty);
            bind.Source = txtbox;
            bind.Mode = BindingMode.TwoWay;
            itemWrap.SetBinding(WordWrapMenuItem.WordWrapProperty, bind);

            // Create Font menu item.
            MenuItem itemFont = new MenuItem();
            itemFont.Header = "_Font...";
            itemFont.Click += FontOnClick;
            itemFormat.Items.Add(itemFont);
        }