/// <summary>
        /// Sets the default page title.
        /// </summary>
        public void SetDefaultPageTitle()
        {
            var img = new Image { };
            img.SetResourceReference(Image.StyleProperty, "MBLogoImageWhite");

            SetPageTitle(img);
        }
Example #2
0
        public TabItem addTabControlWithListOfItems(string header, string name, System.Collections.ObjectModel.ObservableCollection <Chapper.Model.Item> source, string iconSource = null, bool showCloseButton = false, string tooltip = null)
        {
            Grid    grid    = new Grid();
            TabItem newItem = new TabItem();

            try
            {
                newItem.Name = name;
            }
            catch
            {
                newItem.Name = "tab" + tabCounter.ToString();
                tabCounter++;
            }
            if (tooltip == null)
            {
                tooltip = header;
            }

            StackPanel headerBlock = new StackPanel();

            headerBlock.Orientation = Orientation.Horizontal;
            headerBlock.ToolTip     = header;
            if (header.Length > 16)
            {
                header = header.Substring(0, 13) + "...";
            }

            if (iconSource != null)
            {
                headerBlock.Orientation = Orientation.Horizontal;
                System.Windows.Controls.Image tabitemImage = new System.Windows.Controls.Image();
                //tabitemImage.Source = System.Windows.Application.Current.Resources[iconSource] as ImageSource;
                tabitemImage.SetResourceReference(System.Windows.Controls.Image.SourceProperty, iconSource);

                if (!string.IsNullOrEmpty(header))
                {
                    tabitemImage.Height = 12.0;
                }
                else
                {
                    tabitemImage.Height = 16.0;
                }
                tabitemImage.Margin = new Thickness(0, 0, 4, 0);
                headerBlock.Children.Add(tabitemImage);
            }

            if (!string.IsNullOrEmpty(header))
            {
                TextBlock headerText = new TextBlock();
                headerText.Text = header;
                headerBlock.Children.Add(headerText);
            }

            if (showCloseButton)
            {
                Controls.CloseButton closeButton = getTabItemCloseButton(newItem);

                headerBlock.Children.Add(closeButton);
            }
            newItem.Header = headerBlock;
            Controls.ListBoxItems listbox = new Controls.ListBoxItems();
            listbox.Name = "lb_" + name;
            listbox.listbox_items.ItemsSource = source;
            source.CollectionChanged         += source_CollectionChanged;
            grid.Children.Add(listbox);
            newItem.Content = grid;
            this.tabControl_main.Items.Add(newItem);
            return(newItem);
        }