示例#1
0
        private NGroupBox CreateSample(string title, NProperty property, double step, double min, double max, int decimalPlaces)
        {
            NGroupBox groupBox = new NGroupBox(title);

            NStackPanel stack = new NStackPanel();

            groupBox.Content      = stack;
            stack.VerticalSpacing = 10;

            NStackPanel propertyStack = new NStackPanel();

            stack.Add(new NUniSizeBoxGroup(propertyStack));
            propertyStack.HorizontalPlacement = ENHorizontalPlacement.Left;

            NNumberPropertyEditor editor = CreateEditor(property, step, min, max, decimalPlaces);

            propertyStack.Add(new NPairBox("Step = ", editor.Step, true));
            propertyStack.Add(new NPairBox("Minimum = ", editor.Minimum, true));
            propertyStack.Add(new NPairBox("Maximum = ", editor.Maximum, true));
            if (editor is NFloatingNumberPropertyEditor)
            {
                propertyStack.Add(new NPairBox("Decimal Places = ", ((NFloatingNumberPropertyEditor)editor).DecimalPlaces, true));
            }

            for (int i = 0, count = propertyStack.Count; i < count; i++)
            {
                NPairBox    pairBox = (NPairBox)propertyStack[i];
                NUniSizeBox box1    = (NUniSizeBox)pairBox.Box1;
                box1.Content.HorizontalPlacement = ENHorizontalPlacement.Right;
            }

            stack.Add(editor);

            return(groupBox);
        }
示例#2
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            for (int i = 0, count = m_PairBoxes.Length; i < count; i++)
            {
                // Create the pair box property editors
                NPairBox pairBox = m_PairBoxes[i];
                NList <NPropertyEditor> editors = NDesigner.GetDesigner(pairBox).CreatePropertyEditors(pairBox,
                                                                                                       NPairBox.FillModeProperty,
                                                                                                       NPairBox.FitModeProperty
                                                                                                       );

                NUniSizeBox box1 = (NUniSizeBox)pairBox.Box1;
                editors.Add(NDesigner.GetDesigner(box1).CreatePropertyEditor(
                                box1,
                                NUniSizeBox.UniSizeModeProperty
                                ));

                NUniSizeBox box2 = (NUniSizeBox)pairBox.Box2;
                editors.Add(NDesigner.GetDesigner(box2).CreatePropertyEditor(
                                box2,
                                NUniSizeBox.UniSizeModeProperty
                                ));

                // Create the properties stack panel
                NStackPanel propertyStack = new NStackPanel();
                for (int j = 0, editorCount = editors.Count; j < editorCount; j++)
                {
                    propertyStack.Add(editors[j]);
                }

                // Add the box 1 preferred height editor
                NPropertyEditor editor = NDesigner.GetDesigner(box1.Content).CreatePropertyEditor(box1.Content, NWidget.PreferredHeightProperty);
                NLabel          label  = editor.GetFirstDescendant <NLabel>();
                label.Text = "Box 1 Preferred Height:";
                propertyStack.Add(editor);

                // Add the box 2 preferred height editor
                editor     = NDesigner.GetDesigner(box2.Content).CreatePropertyEditor(box2.Content, NWidget.PreferredHeightProperty);
                label      = editor.GetFirstDescendant <NLabel>();
                label.Text = "Box 2 Preferred Height:";
                propertyStack.Add(editor);

                // Create a group box for the properties
                NGroupBox groupBox = new NGroupBox("Pair Box " + (i + 1).ToString());
                groupBox.Content = propertyStack;
                stack.Add(groupBox);
            }

            return(new NUniSizeBoxGroup(stack));
        }