Ejemplo n.º 1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.webBrowser.DocumentCompleted -= new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);
            this.webBrowser.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(webBrowser_DocumentCompleted);

            if (this.ContextMenuActions != null)
            {
                ContextMenu cm = new ContextMenu();

                for (int i = 0; i < this.ContextMenuActions.Count; ++i)
                {
                    MenuActionInfo info = this.ContextMenuActions[i];
                    MenuItem       item = new MenuItem();
                    item.Header = info.Header;
                    item.Click += (s, e) =>
                    {
                        info.DoOnClick(this, e);
                    };
                    cm.Items.Add(item);
                }

                this.ContextMenu = cm;
            }
        }
Ejemplo n.º 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (this.ContextMenuActions != null)
            {
                ContextMenu cm = new ContextMenu();
                for (int i = 0; i < this.ContextMenuActions.Count; ++i)
                {
                    MenuActionInfo info = this.ContextMenuActions[i];

                    MenuItem item = new MenuItem();
                    item.Header = info.Header;
                    if (!info.Icon.IsNullOrEmptyOrWhiteSpace())
                    {
                        item.Icon = StringImageConverter.Convert(info.Icon);
                    }
                    item.Click += (s, a) =>
                    {
                        info.DoOnClick(this, a);
                    };
                    cm.Items.Add(item);
                }
                this.ContextMenu = cm;
            }
        }
Ejemplo n.º 3
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.PART_TextBox = this.Template.FindName("PART_TextBox", this) as XlyHighlightTextBox;

            if (this.ContextMenuActions == null)
            {
                return;
            }

            ContextMenu menu = new ContextMenu();

            for (int i = 0; i < this.ContextMenuActions.Count; ++i)
            {
                MenuActionInfo info = this.ContextMenuActions[i];
                MenuItem       item = new MenuItem();
                item.Header = info.Header;
                if (!info.Icon.IsNullOrEmptyOrWhiteSpace())
                {
                    Border border = new Border();
                    border.Background = new ImageBrush(StringImageConverter.Convert(info.Icon));
                    item.Icon         = border;
                }
                item.InputGestureText = info.KeyText;

                item.Click += (s, a) =>
                {
                    info.DoOnClick(this, a);
                };

                menu.Items.Add(item);
            }

            if (this.PART_TextBox.PART_RichTextBox == null)
            {
                this.PART_TextBox.ApplyTemplate();
            }

            this.PART_TextBox.PART_RichTextBox.ContextMenu = menu;
        }