Пример #1
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            TabControl element = new TabControl(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "TabPage")
                    {
                        string pageLabel = parser.GetAttribute("Text");
                        if (pageLabel == null)
                        {
                            pageLabel = "";
                        }

                        string pageName = parser.GetAttribute("Name");
                        if (pageName == null)
                        {
                            pageName = "";
                        }

                        TabButton button = element.AddPage(pageLabel);
                        button.Name = pageName;

                        ControlBase page = button.Page;
                        parser.ParseContainerContent(page);
                    }
                }
            }
            return(element);
        }
Пример #2
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBoxRow element = new ListBoxRow(parent);

            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                int colIndex = 1;
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Column")
                    {
                        if (parser.MoveToContent())
                        {
                            ControlBase column = parser.ParseElement(element);
                            element.SetCellContents(colIndex++, column, true);
                        }
                        else
                        {
                            string colText = parser.GetAttribute("Text");
                            element.SetCellText(colIndex++, colText != null ? colText : String.Empty);
                        }
                    }
                }
            }
            return(element);
        }
Пример #3
0
        internal static ControlBase XmlElementHandler(Xml.Parser parser, Type type, ControlBase parent)
        {
            ListBoxRow element = new ListBoxRow(parent);
            ListBox    listBox = parent as ListBox;

            if (listBox != null)
            {
                element.ColumnCount = listBox.ColumnCount;
            }
            else
            {
                throw new System.Xml.XmlException("Unknown parent for ListBox Row.");
            }
            parser.ParseAttributes(element);
            if (parser.MoveToContent())
            {
                int colIndex = 1;
                foreach (string elementName in parser.NextElement())
                {
                    if (elementName == "Column")
                    {
                        if (parser.MoveToContent())
                        {
                            ControlBase column = parser.ParseElement(element);
                            element.SetCellContents(colIndex++, column);
                        }
                        else
                        {
                            string colText = parser.GetAttribute("Text");
                            element.SetCellText(colIndex++, colText != null ? colText : String.Empty);
                        }
                    }
                }
            }
            return(element);
        }