private FrameworkElement insertPlugin(Dictionary<String, IAddChild> pluginRoots, IAddChild defaultPluginRoot)
 {
     try
     {
         var assembly = System.Reflection.Assembly.LoadFrom(root + "\\" + name + ".dll");
         var pluginMain = assembly.GetType(name + ".PluginMain");
         var pluginInstance = (UserControl)pluginMain.GetConstructor(new Type[0]).Invoke(new object[0]);
         var pluginGroup = new RibbonGroup();
         if (pluginMain.GetFields().Where(f => f.Name == "preferredTab").Count() == 1)
         {
             var preferredTab = (string)pluginMain.GetField("preferredTab").GetValue(pluginInstance);
             if (preferredTab == "PenTools" || preferredTab == "Navigate")
             {
                 pluginRoots[preferredTab].AddChild(pluginInstance);
                 return pluginInstance;
             }
             if (pluginRoots.ContainsKey(preferredTab))
             {
                 pluginGroup.Header = name;
                 pluginGroup.Items.Add(pluginInstance);
                 pluginRoots[preferredTab].AddChild(pluginGroup);
             }
             else
             {
                 throw new InvalidPluginFormatException(name, "This plugin has requested to live in a tab which does not exist: " + preferredTab + ".  Available tabs are: " + pluginRoots.Keys.Aggregate("", (key, acc) => key + " " + acc));
             }
         }
         else
         {
             //Uncomment these lines to make the plugin live in a RibbonGroup that will collapse at priority 9, go to small at 8 and go to medium at 7.
             //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Collapsed,9));
             //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Small,8));
             //pluginGroup.Variants.Add(new GroupVariant(pluginGroup,RibbonGroupVariant.Medium,7));
             pluginGroup.Header = name;
             pluginGroup.Items.Add(pluginInstance);
             defaultPluginRoot.AddChild(pluginGroup);
         }
         return pluginInstance;
     }
     catch (Exception e)
     {
         throw new InvalidPluginFormatException(name, "This plugin has failed to instantiate its main class (which must be named PluginMain) correctly, failing with the error: " + e.Message);
     }
 }
        // Token: 0x06000698 RID: 1688 RVA: 0x00014E4C File Offset: 0x0001304C
        internal static void AddNodeToLogicalTree(DependencyObject parent, Type type, bool treeNodeIsFE, FrameworkElement treeNodeFE, FrameworkContentElement treeNodeFCE)
        {
            FrameworkContentElement frameworkContentElement = parent as FrameworkContentElement;

            if (frameworkContentElement != null)
            {
                IEnumerator logicalChildren = frameworkContentElement.LogicalChildren;
                if (logicalChildren != null && logicalChildren.MoveNext())
                {
                    throw new InvalidOperationException(SR.Get("AlreadyHasLogicalChildren", new object[]
                    {
                        parent.GetType().Name
                    }));
                }
            }
            IAddChild addChild = parent as IAddChild;

            if (addChild == null)
            {
                throw new InvalidOperationException(SR.Get("CannotHookupFCERoot", new object[]
                {
                    type.Name
                }));
            }
            if (treeNodeFE != null)
            {
                addChild.AddChild(treeNodeFE);
                return;
            }
            addChild.AddChild(treeNodeFCE);
        }
        private void InitializeComponent()
        {
            this.Width = this.Height = 200;
            this.Left  = this.Top = 100;
            this.Title = "Code-Only Window";

            #region Container
            DockPanel dockPanel = new DockPanel();

            _button         = new Button();
            _button.Content = "Click Me";
            _button.Margin  = new Thickness(30);

            _button.Click += (sender, eventArgs) =>
            {
                _button.Content = "Value Changed";
            };

            IAddChild container = dockPanel;
            container.AddChild(_button);

            container = this;
            container.AddChild(dockPanel);

            #endregion
        }
Exemple #4
0
        private void InitializeComponent()
        {
            Width  = 500;
            Height = 300;
            Title  = "Code Only";

            Grid grid = new Grid();

            Button btnTest = new Button();

            btnTest.Content             = "测试";
            btnTest.Width               = 100;
            btnTest.Height              = 20;
            btnTest.VerticalAlignment   = VerticalAlignment.Top;
            btnTest.HorizontalAlignment = HorizontalAlignment.Left;
            btnTest.Margin              = new Thickness(30);

            btnTest.Click += BtnTest_Click;

            IAddChild container = grid;

            container.AddChild(btnTest);

            container = this;
            container.AddChild(grid);
        }
Exemple #5
0
        private void InitializeComponent()
        {
            //Configure the form
            this.Width = this.Height = 285;
            this.Left  = this.Top = 100;
            this.Title = "Code-Only Window";

            //Create a container to hold a button
            DockPanel panel = new DockPanel();

            //Create the button
            button1         = new Button();
            button1.Content = "Please click me.";
            button1.Margin  = new Thickness(30);

            //Attach the event handler
            button1.Click += button1_Click;

            //Place the button in the panel.
            IAddChild container = panel;

            container.AddChild(button1);

            //Place the panel in the form.
            container = this;
            container.AddChild(panel);
        }
Exemple #6
0
        private void InitializeComponent()
        {
            //设置窗体
            this.Width  = 285;
            this.Height = 250;
            this.Left   = this.Top = 100;
            this.Title  = "Use code to create wpf application.";

            //创建停靠的面板对象
            DockPanel panel = new DockPanel();

            //创建按钮对象
            button1         = new Button();
            button1.Content = "Click me";
            button1.Margin  = new Thickness(30);
            button1.Click  += Button1_Click;

            //创建容器
            IAddChild container = panel;

            container.AddChild(button1);

            container = this;
            container.AddChild(panel);
        }
Exemple #7
0
        private void InitializeComponent()
        {
            //设置窗体大小
            this.Width = 285; this.Height = 250;
            this.Left  = 100; this.Top = 100;
            this.Title = "Create Window By Code";

            //创建一个停靠面板对象,用来放组件
            DockPanel panel = new DockPanel();

            //创建按钮对象
            button1         = new Button();
            button1.Content = "点击";
            button1.Margin  = new Thickness(30);

            //添加事件处理程序
            button1.Click += btn1_Click;

            //将按钮添加到面板中
            IAddChild container = panel;

            container.AddChild(button1);

            //将面板添加到Window窗体中
            container = this;
            container.AddChild(panel);
        }
Exemple #8
0
        /// <summary>
        /// Create next UI layer and set it as active.
        /// </summary>
        /// <param name="nextLayerRoot">Element that will be root of the new layer.</param>
        public LayoutLayer GoDeeper(IAddChild nextLayerRoot)
        {
            // Validate shared reference.
            if (nextLayerRoot == null)
            {
                throw new NullReferenceException("Root element can't be null.");
            }

            // Add shared root as child on current layer.
            root.AddChild(nextLayerRoot);

            // Configurate new layer.
            var newLayer = new LayoutLayer()
            {
                root   = nextLayerRoot, // Set shared element as root
                Parent = this           // Set reference to current active layer like on the parent.
            };

            // Define orientation of the layout group.
            if (nextLayerRoot is StackPanel)
            {
                newLayer.orientation = Orientation.Vertical;
            }
            else
            {
                newLayer.orientation = Orientation.Horizontal;
            }

            // Return new layer.
            return(newLayer);
        }
 internal static void ApplyTemplate(IAddChild decendant, IEnumerable items)
 {
     foreach (var item in items)
     {
         decendant.AddChild(item);
     }
 }
Exemple #10
0
        private void NewTextWindow(string str)
        {
            //创建基本窗口
            Window newWindow = new Window();

            newWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newWindow.WindowStyle           = WindowStyle.ThreeDBorderWindow;
            newWindow.ResizeMode            = ResizeMode.CanResize;
            //newWindow.AllowsTransparency=true;
            //创建组件容器

            TextBox textBox1 = new TextBox();

            textBox1.Text         = str;
            textBox1.TextWrapping = TextWrapping.WrapWithOverflow;
            textBox1.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            textBox1.AcceptsReturn     = true;
            textBox1.Margin            = new Thickness(0);
            textBox1.VerticalAlignment = VerticalAlignment.Top;
            IAddChild conAddChild = newWindow;

            conAddChild.AddChild(textBox1);

            newWindow.Show();
            newWindow.Topmost = true;
        }
Exemple #11
0
        private void NewImgWindow(string path)
        {
            TempWindow = new Window();
            TempWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            TempWindow.WindowStyle           = WindowStyle.None;
            TempWindow.ResizeMode            = ResizeMode.CanResize;
            TempWindow.AllowsTransparency    = true;

            // Image image = new Image();
            image = new Image();
            ImageSource imageSource = new BitmapImage(new Uri(path));

            image.Source = imageSource;
            image.Margin = new Thickness(0);
            image.HorizontalAlignment = HorizontalAlignment.Left;
            image.VerticalAlignment   = VerticalAlignment.Top;
            image.MouseDown          += Image_MouseDown;
            IAddChild conAddChild = TempWindow;

            conAddChild.AddChild(image);
            TempWindow.Height = imageSource.Height;
            TempWindow.Width  = imageSource.Width;
            TempWindow.Show();
            TempWindow.Topmost = true;
        }
        private void InitializeComponent()
        {
            var panel = new StackPanel();

            panel.Orientation = Orientation.Vertical;
            IAddChild container = panel;

            if (Questions.Sections == null)
            {
                this.UpdateLayout(); return;
            }
            ;
            var setText = new TextBlock
            {
                Text = "Тема теста: \"" + Questions.Name + "\""
            };
            int sectionNumber = 1;

            container.AddChild(setText);
            container.AddChild(new Separator());
            foreach (var section in Questions.Sections)
            {
                int questionNumber = 1;
                var sectionText    = new TextBlock
                {
                    Text = sectionNumber + ") Раздел \"" + section.Name + "\""
                };
                container.AddChild(sectionText);
                foreach (var question in section.Questions)
                {
                    var questionText = new TextBlock
                    {
                        Text                = questionNumber + ". " + question.Text,
                        TextWrapping        = TextWrapping.Wrap,
                        HorizontalAlignment = HorizontalAlignment.Left,
                        Width               = 650d
                    };
                    container.AddChild(questionText);
                    int answerNumber = 1;
                    foreach (var answer in question.Answers)
                    {
                        var radio = new RadioButton
                        {
                            Content   = answer.Text,
                            GroupName = "Group_" + sectionNumber + "_" + questionNumber,
                            Tag       = new Tuple <Question, Answer>(question, answer)
                        };
                        radio.Checked += Radio_Checked;
                        container.AddChild(radio);
                        answerNumber++;
                    }
                    questionNumber++;
                }
                container.AddChild(new Separator());
                sectionNumber++;
            }

            container = this;
            container.AddChild(panel);
        }
Exemple #13
0
        public void InitializeComponent()
        {
            this.Width  = 285;
            this.Height = 250;
            this.Left   = this.Top = 100;
            this.Title  = "Code-Only Window";
            DockPanel pa = new DockPanel();

            btn1         = new Button();
            btn1.Content = "Please click me";
            btn1.Margin  = new Thickness(30);
            btn1.Click  += btn1_clieck;
            IAddChild con = pa;

            con.AddChild(btn1);
            con = this;
            con.AddChild(pa);
        }
Exemple #14
0
 public IAddChild AppendCefBrowser(IAddChild container)
 {
     if (Browser == null)
     {
         throw new InvalidOperationException("必须先InitCefBrowser,然后才能使用");
     }
     container.AddChild(Browser);
     return(container);
 }
Exemple #15
0
        private void InitializeComponent()
        {
            this.Width = this.Height = this.Top = this.Left = 300;
            this.Title = "Code Only";

            DockPanel dockpanel = new DockPanel();

            button1         = new Button();
            button1.Content = "Lithum";
            button1.Margin  = new Thickness(3);
            button1.Click  += button1_Click;

            IAddChild container = dockpanel;

            container.AddChild(button1);
            container = this;
            container.AddChild(dockpanel);
        }
Exemple #16
0
        private static void AddInline([NotNull] IAddChild parent, [NotNull] Inline inline)
        {
            if (!EndsWithSpace(parent) && !StartsWithSpace(inline))
            {
                parent.AddText(" ");
            }

            parent.AddChild(inline);
        }
Exemple #17
0
        public WindowUI(IAddChild parent)
        {
            layout = new Grid()
            {
                Width     = double.NaN,
                Height    = double.NaN,
                Focusable = false
            };

            parent.AddChild(layout);
        }
Exemple #18
0
 public void LoadXaml(IAddChild parent = null)
 {
     if (Control != null)
     {
         initiatorObj.dispose(Control, CodeHandler);
         loader.Update();
     }
     Control = loader.View;
     parent?.AddChild(Control);
     initiatorObj.initiate(Control, CodeHandler);
 }
        public void IAddChildTest()
        {
            Decorator d         = new Decorator();
            IAddChild add_child = (IAddChild)d;
            UIElement b         = new UIElement();

            add_child.AddChild(b);
            Assert.AreSame(d.Child, b, "1");
            try {
                add_child.AddChild(new UIElement());
                Assert.Fail("2");
            } catch (ArgumentException ex) {
                Assert.AreEqual(ex.Message, "'System.Windows.Controls.Decorator' already has a child and cannot add 'System.Windows.UIElement'. 'System.Windows.Controls.Decorator' can accept only one child.", "3");
            }
            d.Child = null;
            try {
                add_child.AddChild(new DrawingVisual());
                Assert.Fail("4");
            } catch (ArgumentException ex) {
                Assert.AreEqual(ex.Message, "Parameter is unexpected type 'System.Windows.Media.DrawingVisual'. Expected type is 'System.Windows.UIElement'.\r\nParameter name: value", "5");
            }
            d.Child = new UIElement();
            try {
                add_child.AddChild(new DrawingVisual());
                Assert.Fail("5");
            } catch (ArgumentException ex) {
                Assert.AreEqual(ex.Message, "Parameter is unexpected type 'System.Windows.Media.DrawingVisual'. Expected type is 'System.Windows.UIElement'.\r\nParameter name: value", "6");
            }
            d.Child = null;
            try {
                add_child.AddChild(null);
                Assert.Fail("7");
            } catch (NullReferenceException) {
            }
            try {
                add_child.AddText("1");
                Assert.Fail("8");
            } catch (ArgumentException ex) {
                Assert.AreEqual(ex.Message, "'1' text cannot be added because text is not valid in this element.", "9");
            }
        }
        public static Gamma AddNewGamma(this IAddChild <Gamma> source, int a)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            Gamma g = new Gamma();

            source.AddChild(g);
            return(g);
        }
Exemple #21
0
        /// <summary> Constructor. 
        /// </summary>
        /// <param name="model">The tree model to view.</param>
        public View(Model model, IAddChild visualRoot)
        {
            _model = model;
            _visualRoot = visualRoot;

            _renderer = new Renderer(_model, this);
            _controller = new Controller(_renderer);

            _visualRoot.AddChild(_renderer);

            this.StartMouseListening();
        }
            public IAddChildMembersCallTheOtherMembersContentControl()
            {
                IAddChild add_child = (IAddChild)this;

                Assert.AreEqual(add_child_calls, 0, "1");
                add_child.AddChild(1);
                Assert.AreEqual(add_child_calls, 1, "2");
                Content = null;
                Assert.AreEqual(add_text_calls, 0, "3");
                add_child.AddText("1");
                Assert.AreEqual(add_text_calls, 1, "4");
            }
Exemple #23
0
        /// <summary> Constructor.
        /// </summary>
        /// <param name="model">The tree model to view.</param>
        public View(Model model, IAddChild visualRoot)
        {
            _model      = model;
            _visualRoot = visualRoot;

            _renderer   = new Renderer(_model, this);
            _controller = new Controller(_renderer);

            _visualRoot.AddChild(_renderer);

            this.StartMouseListening();
        }
Exemple #24
0
        private void InitializeComponet()
        {
            //配置窗体大小
            this.Width  = 280;
            this.Height = 250;
            this.Left   = this.Top = 100;
            this.Title  = "CodeOnlyWindow";
            //创建面板对象
            DockPanel panel = new DockPanel();

            //创建按钮对象
            button1         = new Button();
            button1.Content = "点击我";
            button1.Margin  = new Thickness(30);
            button1.Click  += button1_click;
            IAddChild container = panel;

            container.AddChild(button1);
            container = this;
            container.AddChild(panel);
        }
Exemple #25
0
        /// <summary>
        /// The toolbar tray which will be used in the application
        /// </summary>
        private void RefreshToolbar()
        {
            ToolBarTray tray  = new ToolBarTray();
            IAddChild   child = tray;

            foreach (AbstractCommandable node in _toolbarService.Children)
            {
                if (node is AbstractToolbar value)
                {
                    ToolBar tb = new ToolBar();

                    DataTemplateSelector t = FindResource("toolBarItemTemplateSelector") as DataTemplateSelector;
                    tb.SetValue(ItemsControl.ItemTemplateSelectorProperty, t);

                    //Set the necessary bindings
                    Binding bandBinding       = new Binding("Band");
                    Binding bandIndexBinding  = new Binding("BandIndex");
                    Binding visibilityBinding = new Binding("IsChecked")
                    {
                        Converter = btv
                    };

                    bandBinding.Source       = value;
                    bandIndexBinding.Source  = value;
                    visibilityBinding.Source = value;

                    bandBinding.Mode      = BindingMode.TwoWay;
                    bandIndexBinding.Mode = BindingMode.TwoWay;

                    tb.SetBinding(ToolBar.BandProperty, bandBinding);
                    tb.SetBinding(ToolBar.BandIndexProperty, bandIndexBinding);
                    tb.SetBinding(ToolBar.VisibilityProperty, visibilityBinding);

                    tb.ItemsSource = value.Children;
                    child.AddChild(tb);
                }
            }

            // update context menu if available
            tray.ContextMenu = null;
            if (_toolbarService.ContextMenuItems != null && _toolbarService.ContextMenuItems.Children.Count() > 0)
            {
                // Update Context Menu
                tray.ContextMenu = new ContextMenu
                {
                    ItemsSource        = _toolbarService.ContextMenuItems.Children,
                    ItemContainerStyle = FindResource("ToolbarContextMenu") as Style,
                };
            }

            content.Content = tray;
        }
Exemple #26
0
        private void HandleImage(Inline inline, IAddChild parent)
        {
            NoteFile  nf     = CurrentNote.Files.FirstOrDefault(n => n.FileName == inline.TargetUrl);
            Paragraph result = parent as Paragraph;

            if (result == null)
            {
                result = new Paragraph();
                parent.AddChild(result);
            }

            if (nf != null && File.Exists(nf.FullName))
            {
                if (!string.IsNullOrWhiteSpace(inline.LiteralContent))
                {
                    result.ToolTip = inline.LiteralContent;
                }

                var imageUri = new Uri(nf.FullName, UriKind.Absolute);

                var imgTemp = new BitmapImage();
                imgTemp.BeginInit();
                imgTemp.CacheOption   = BitmapCacheOption.OnLoad;
                imgTemp.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                imgTemp.UriSource     = imageUri;
                imgTemp.EndInit();

                var image = new Image
                {
                    Source           = imgTemp,
                    Stretch          = Stretch.None,
                    StretchDirection = StretchDirection.Both,
                    MaxWidth         = imgTemp.Width,
                    MaxHeight        = imgTemp.Height
                };

                if (ImageStyle != null)
                {
                    image.Style = ImageStyle;
                }


                result.Inlines.Add(image);
            }
            else if (nf != null)
            {
                result.Inlines.Add(new Run("Missing file: " + nf.FullName));
            }
        }
Exemple #27
0
        public static T AttachTo <T>(this T e, IAddChild c)
            where T : UIElement
        {
            if (e == null)
            {
                return(e);
            }


            UIElement x = e;

            c.AddChild(x);

            return(e);
        }
        internal static void AddNodeToLogicalTree(DependencyObject parent, Type type, bool treeNodeIsFE, Appercode.UI.Controls.UIElement treeNodeFE, Appercode.UI.Controls.UIElement treeNodeFCE)
        {
            Appercode.UI.Controls.UIElement frameworkContentElement = parent as Appercode.UI.Controls.UIElement;
            if (frameworkContentElement != null)
            {
                IEnumerator logicalChildren = frameworkContentElement.LogicalChildren;
                if (logicalChildren != null && logicalChildren.MoveNext())
                {
                    throw new InvalidOperationException("AlreadyHasLogicalChildren");
                }
            }
            IAddChild addChild = parent as IAddChild;

            if (addChild == null)
            {
                throw new InvalidOperationException("CannotHookupFCERoot");
            }
            if (treeNodeFE != null)
            {
                addChild.AddChild(treeNodeFE);
                return;
            }
            addChild.AddChild(treeNodeFCE);
        }
Exemple #29
0
        private void AddLeaf(double x, double y)
        {
            TextBox leafItem = new TextBox();

            leafItem.Text                = "Leaf";
            leafItem.Margin              = new Thickness(x - 190, y - 80, 0, 0);
            leafItem.Style               = this.FindResource("LeafMind") as Style;
            leafItem.MouseLeftButtonUp  += GetPositionHandler;
            leafItem.MouseRightButtonUp += DrawLineHandler;
            IAddChild container = null;

            container = MyGrid;
            container.AddChild(leafItem);
            leafItem.TextChanged += CompositeCreateHandler;
        }
Exemple #30
0
        private void AddBrunch(double x, double y)
        {
            TextBox brunchItem = new TextBox();

            brunchItem.Text   = "Branch";
            brunchItem.Margin = new Thickness(x - 190, y - 80, 0, 0);
            brunchItem.Style  = this.FindResource("BrunchMind") as Style;
            IAddChild container = null;

            brunchItem.MouseLeftButtonUp  += GetPositionHandler;
            brunchItem.MouseRightButtonUp += DrawLineHandler;
            container = MyGrid;
            container.AddChild(brunchItem);
            brunchItem.TextChanged += CreateBrunchHandler;
        }
        private static void OnKeyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
        {
            IAddChild addChild = dependencyObject as IAddChild;

            if (addChild != null)
            {
                if (args.NewValue != null)
                {
                    addChild.AddChild(App.Current.FindResource(args.NewValue));
                }
            }
            else
            {
                throw new NotSupportedException();
            }
        }
 public void Build()
 {
     sWindow = new Window {Width = 350, Height = 500, Title = "Настройки"};
     var scrollViewer = new ScrollViewer();
     scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
     var stackPanel = new StackPanel {Margin = new Thickness(5)};
     container = scrollViewer;
     container.AddChild(stackPanel);
     mainStackPanel = stackPanel;
     settings.ForEachSetByUserFieldsGroup(CreatePropertiesExpander, FillGroup);
     var bSave = new Button {Content = "Сохранить"};
     bSave.Click += bSave_Click;
     (mainStackPanel as IAddChild).AddChild(bSave);
     container = sWindow;
     container.AddChild(scrollViewer);
     sWindow.ShowDialog();
 }
        public void RegisterResult(string parkName, string parkFreetime, string parkPrice, string parkCount, string parkAddress)
        {
            Window w = new Window();

            w.Width  = 300;
            w.Height = 500;
            w.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            w.ResizeMode            = ResizeMode.NoResize;
            Label BT = new Label();

            BT.Content    = "注册成功!";
            BT.Foreground = Brushes.Red;
            BT.Margin     = new Thickness(100, 10, 0, 0);
            Label lb1 = new Label();

            lb1.Content = "您注册的停车场名称:" + parkName.ToString();
            lb1.Margin  = new Thickness(0, 30, 10, 0);
            Label lb2 = new Label();

            lb2.Content = "您注册的停车场价格:" + parkFreetime.ToString();
            lb2.Margin  = new Thickness(0, 60, 10, 0);
            Label lb3 = new Label();

            lb3.Content = "您注册的停车场免费时间:" + parkPrice.ToString();
            lb3.Margin  = new Thickness(0, 90, 10, 0);
            Label lb4 = new Label();

            lb4.Content = "您注册的停车场车位数量:" + parkCount.ToString();
            lb4.Margin  = new Thickness(0, 120, 10, 0);
            Label lb5 = new Label();

            lb5.Content = "您注册的停车场地址:" + parkAddress.ToString();
            lb5.Margin  = new Thickness(0, 150, 10, 0);
            Grid      panel     = new Grid();
            IAddChild container = panel;

            container.AddChild(BT);
            container.AddChild(lb1);
            container.AddChild(lb2);
            container.AddChild(lb3);
            container.AddChild(lb4);
            container.AddChild(lb5);
            //将面板放置到窗体中
            container = w;
            container.AddChild(panel);
            w.Show();
        }
 private void CreatePropertiesExpander(string groupCaption)
 {
     var expander = new Expander();
     expander.Header = groupCaption;
     (mainStackPanel as IAddChild).AddChild(expander);
     container = expander;
     var stackPanel = new StackPanel();
     container.AddChild(stackPanel);
     container = stackPanel;
 }