Beispiel #1
0
        public void UpdateTab(int index, string title, Color backColor, Color textColor)
        {
            SheetTabItem item = this.canvas.Children[index] as SheetTabItem;

            if (item != null)
            {
                item.ChangeTitle(title);
                this.canvas.ColumnDefinitions[index].Width = new GridLength(item.Width + 1);

                item.BackColor = backColor;
                item.TextColor = textColor;
            }
        }
Beispiel #2
0
        public void InsertTab(int index, string title)
        {
            var tab = new SheetTabItem(this, title)
            {
                Height = this.canvas.Height,
            };

            this.canvas.Width += tab.Width + 1;
            this.canvas.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(tab.Width + 1)
            });

            this.canvas.Children.Add(tab);

            Grid.SetColumn(tab, index);

            tab.MouseDown += (s, e) =>
            {
                var arg = new SheetTabMouseEventArgs()
                {
                    Handled      = false,
                    Location     = e.GetPosition(this),
                    Index        = index,
                    MouseButtons = WPFUtility.ConvertToUIMouseButtons(e),
                };

                if (this.TabMouseDown != null)
                {
                    this.TabMouseDown(this, arg);
                }

                if (!arg.Handled)
                {
                    this.SelectedIndex = index;
                }
            };

            if (this.canvas.Children.Count == 1)
            {
                tab.IsSelected = true;
            }
        }
Beispiel #3
0
        public void InsertTab(int index, string title)
        {
            var tab = new SheetTabItem(this, title)
            {
                Height = this.canvas.Height,
            };

            this.canvas.Width += tab.Width + 1;
            this.canvas.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(tab.Width + 1)
            });

            this.canvas.Children.Add(tab);

            Grid.SetColumn(tab, index);

            tab.MouseDown += Tab_MouseDown;

            if (this.canvas.Children.Count == 1)
            {
                tab.IsSelected = true;
            }
        }