Ejemplo n.º 1
0
        private void ScrollingHost_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
        {
            var scrollingHost = List.ItemsPanelRoot as ItemsWrapGrid;

            if (scrollingHost != null)
            {
                var first = List.ContainerFromIndex(scrollingHost.FirstVisibleIndex);
                if (first != null)
                {
                    var header = List.GroupHeaderContainerFromItemContainer(first) as GridViewHeaderItem;
                    if (header != null && header != Toolbar.SelectedItem)
                    {
                        if (header.Content is EmojiGroup)
                        {
                            Toolbar2.SelectedItem = null;
                            Toolbar.SelectedItem  = header.Content;
                            Toolbar.ScrollIntoView(header.Content);
                        }
                        else
                        {
                            Toolbar.SelectedItem  = null;
                            Toolbar2.SelectedItem = header.Content;
                            Toolbar2.ScrollIntoView(header.Content);
                        }

                        UpdateToolbar();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void Button_CopyToOther(object sender, RoutedEventArgs e)
 {
     if (Toolbar1.IsAncestorOf((DependencyObject)e.Source))
     {
         Graph g = GraphEditor1.CurrentGraph();
         GraphEditor2.LoadGraph(g);
     }
     if (Toolbar2.IsAncestorOf((DependencyObject)e.Source))
     {
         Graph g = GraphEditor2.CurrentGraph();
         GraphEditor1.LoadGraph(g);
     }
 }
Ejemplo n.º 3
0
 private void Button_LoadDot(object sender, RoutedEventArgs e)
 {
     if (Toolbar1.IsAncestorOf((DependencyObject)e.Source))
     {
         string content = new TextRange(TextEditor1.Document.ContentStart, TextEditor1.Document.ContentEnd).Text;
         GraphEditor1.LoadDotString(content);
     }
     if (Toolbar2.IsAncestorOf((DependencyObject)e.Source))
     {
         string content = new TextRange(TextEditor2.Document.ContentStart, TextEditor2.Document.ContentEnd).Text;
         GraphEditor2.LoadDotString(content);
     }
 }
Ejemplo n.º 4
0
 private void Button_SerializeDot(object sender, RoutedEventArgs e)
 {
     if (Toolbar1.IsAncestorOf((DependencyObject)e.Source))
     {
         string dot = GraphEditor1.SerializeGraphAsDotString();
         TextEditor1.Document.Blocks.Clear();
         TextEditor1.Document.Blocks.Add(new Paragraph(new Run(dot)));
     }
     if (Toolbar2.IsAncestorOf((DependencyObject)e.Source))
     {
         string dot = GraphEditor2.SerializeGraphAsDotString();
         TextEditor2.Document.Blocks.Clear();
         TextEditor2.Document.Blocks.Add(new Paragraph(new Run(dot)));
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 控件初始化函数
        /// </summary>
        /// <param name="e">初始化事件参数</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            // 初始化工具条 1
            this.m_toolbar1 = new Toolbar1();
            // 初始化工具条2
            this.m_toolbar2 = new Toolbar2();

            // <span contenteditable=true></span>
            this.m_spanDesigner = new Bincess.Components.Web.TextPane.DesignPane();
            // <textarea></textarea>
            this.m_textModel = new Bincess.Components.Web.TextPane.TextModel();

            // 添加控件到集合
            this.Controls.Add(this.m_textModel);
        }