Ejemplo n.º 1
0
        /// <summary>
        /// Creates a label format combo box
        /// </summary>
        /// <returns></returns>
        private NComboBox CreateLabelFormatComboBox()
        {
            NComboBox comboBox = new NComboBox();

            NComboBoxItem comboBoxItem = new NComboBoxItem("Value");

            comboBoxItem.Tag = "<value>";
            comboBox.Items.Add(comboBoxItem);

            comboBoxItem     = new NComboBoxItem("Total");
            comboBoxItem.Tag = "<total>";
            comboBox.Items.Add(comboBoxItem);

            comboBoxItem     = new NComboBoxItem("Cumulative");
            comboBoxItem.Tag = "<cumulative>";
            comboBox.Items.Add(comboBoxItem);

            comboBoxItem     = new NComboBoxItem("Percent");
            comboBoxItem.Tag = "<percent>";
            comboBox.Items.Add(comboBoxItem);

            comboBox.SelectedIndex = 0;

            return(comboBox);
        }
        void OnColumnsComboBoxSelectedIndexChanged(NValueChangeEventArgs arg)
        {
            NComboBoxItem item = m_ColumnsComboBox.SelectedItem;

            if (item == null)
            {
                m_ColumnPropertiesHolder.Content = null;
                return;
            }

            NColumn column = (NColumn)item.Tag;

            NStackPanel columnPropertiesStack = new NStackPanel();

            m_ColumnPropertiesHolder.Content = new NUniSizeBoxGroup(columnPropertiesStack);

            NDesigner designer = NDesigner.GetDesigner(column);
            NList <NPropertyEditor> editors = designer.CreatePropertyEditors(column,
                                                                             NColumn.AllowFilterProperty,
                                                                             NColumn.AllowSortProperty,
                                                                             NColumn.AllowGroupProperty,
                                                                             NColumn.AllowFormatProperty,
                                                                             NColumn.AllowEditProperty,
                                                                             NColumn.AllowReorderProperty,
                                                                             NColumn.AllowResizeProperty);

            for (int i = 0; i < editors.Count; i++)
            {
                columnPropertiesStack.Add(editors[i]);
            }
        }
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            // create the columns combo box
            {
                stack.Add(new NLabel("Select Column:"));
                m_ColumnsComboBox = new NComboBox();
                stack.Add(m_ColumnsComboBox);
                for (int i = 0; i < m_GridView.Grid.Columns.Count; i++)
                {
                    NColumn       column = m_GridView.Grid.Columns[i];
                    NComboBoxItem item   = new NComboBoxItem(column.Title);
                    item.Tag = column;
                    m_ColumnsComboBox.Items.Add(item);
                }

                m_ColumnsComboBox.SelectedIndexChanged += OnColumnsComboBoxSelectedIndexChanged;

                // create the columns
                m_ColumnPropertiesHolder = new NContentHolder();
                stack.Add(new NGroupBox("Selected Column Properties", m_ColumnPropertiesHolder));
            }

            return(stack);
        }
Ejemplo n.º 4
0
        void OnColumnsComboBoxSelectedIndexChanged(NValueChangeEventArgs arg)
        {
            NComboBoxItem item = m_ColumnsComboBox.SelectedItem;

            if (item == null)
            {
                m_ColumnPropertiesHolder.Content = null;
            }
            else
            {
                NColumn column = (NColumn)item.Tag;

                NStackPanel columnPropertiesStack = new NStackPanel();
                m_ColumnPropertiesHolder.Content = new NUniSizeBoxGroup(columnPropertiesStack);

                NDesigner designer = NDesigner.GetDesigner(column);
                NList <NPropertyEditor> editors = designer.CreatePropertyEditors(column,
                                                                                 NColumn.WidthModeProperty,
                                                                                 NColumn.FixedWidthProperty,
                                                                                 NColumn.WidthPercentProperty);

                for (int i = 0; i < editors.Count; i++)
                {
                    columnPropertiesStack.Add(editors[i]);
                }
            }
        }
Ejemplo n.º 5
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack = new NStackPanel();

            stack.FillMode = ENStackFillMode.Last;
            stack.FitMode  = ENStackFitMode.Last;

            NGroupBox groupBox = new NGroupBox("Culture:");

            stack.Add(groupBox);
            groupBox.Margins = new NMargins(0, 0, 0, 10);

            // add the cultures combo box
            int       selectedIndex = -1;
            NComboBox combo         = new NComboBox();

            for (int i = 0, count = Cultures.Count; i < count; i++)
            {
                CultureInfo   culture = Cultures[i];
                NComboBoxItem item    = new NComboBoxItem(culture.EnglishName);
                item.Tag = culture.Name;
                combo.Items.Add(item);

                if (culture.Name == m_Calendar.CultureName)
                {
                    selectedIndex = i;
                }
            }

            groupBox.Content            = combo;
            combo.SelectedIndexChanged += new Function <NValueChangeEventArgs>(OnCultureComboSelectedIndexChanged);

            // add the property editors
            NList <NPropertyEditor> editors = NDesigner.GetDesigner(m_Calendar).CreatePropertyEditors(
                m_Calendar,
                NCalendar.EnabledProperty,
                NCalendar.HighlightTodayProperty,
                NCalendar.MonthFormatModeProperty,
                NCalendar.DayOfWeekFormatModeProperty
                );

            for (int i = 0; i < editors.Count; i++)
            {
                stack.Add(editors[i]);
            }

            // add the events log
            m_EventsLog = new NExampleEventsLog();
            stack.Add(m_EventsLog);

            return(new NUniSizeBoxGroup(stack));
        }
Ejemplo n.º 6
0
        private void OnCultureComboSelectedIndexChanged(NValueChangeEventArgs args)
        {
            NComboBox combo = args.TargetNode as NComboBox;

            NComboBoxItem selectedItem = combo.SelectedItem;

            if (selectedItem == null)
            {
                return;
            }

            m_Calendar.CultureName = (string)selectedItem.Tag;
        }
Ejemplo n.º 7
0
        private void OnCountryDataBindingCreateItemNode(NCreateItemNodeEventArgs <NComboBoxItem, NCountry> args)
        {
            NCountry country = args.Item;

            // Create a stack panel
            NStackPanel stack = new NStackPanel();

            stack.Padding = new NMargins(3);
            stack.Tag     = country;

            // Create the flag image box and the country name label
            NLabel countryLabel = new NLabel(country.Name);

            countryLabel.VerticalPlacement = ENVerticalPlacement.Center;
            countryLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold);

            NImageBox imageBox = new NImageBox(country.Flag);

            imageBox.VerticalPlacement   = ENVerticalPlacement.Center;
            imageBox.HorizontalPlacement = ENHorizontalPlacement.Left;

            NPairBox pairBox = new NPairBox(imageBox, countryLabel);

            pairBox.Spacing = 3;
            stack.Add(pairBox);

            // Create the capital label
            NLabel capitalLabel = new NLabel("Capital: " + country.Capital);

            stack.Add(capitalLabel);

            // Create the currency label
            NLabel currencyLabel = new NLabel("Currency: " + country.CurrencyName + ", " +
                                              country.CurrencyCode);

            stack.Add(currencyLabel);

            // Create a combo box item to host the created widget
            NComboBoxItem comboBoxItem = new NComboBoxItem(stack);

            comboBoxItem.Text = country.Name;
            args.Node         = comboBoxItem;
        }
Ejemplo n.º 8
0
        private void OnComboBoxSelectedIndexChanged(NValueChangeEventArgs args)
        {
            if (m_bSelectionUpdating)
            {
                m_bSelectionUpdating = false;
                return;
            }

            // Get the list box and the other list box
            int       selectedIndex = (int)args.NewValue;
            NComboBox comboBox      = (NComboBox)args.TargetNode;
            NComboBox otherComboBox = comboBox == m_ComboBox ? m_AdvancedComboBox : m_ComboBox;

            // Log the selection
            NComboBoxItem selectedItem = comboBox.SelectedItem;
            NCountry      country      = NNodeCollectionDataBinding <NComboBoxItemCollection, NComboBoxItem, NCountry> .GetDataBoundItem(selectedItem);

            m_EventsLog.LogEvent("'" + country.Name + "' selected");

            // Synchronize the selection between the two list boxes
            m_bSelectionUpdating        = true;
            otherComboBox.SelectedIndex = selectedIndex;
        }
Ejemplo n.º 9
0
        private NComboBox CreateLegendFormatCombo()
        {
            NComboBox comboBox = new NComboBox();

            NComboBoxItem item = new NComboBoxItem("Value and Label");

            item.Tag = "<value> <label>";
            comboBox.Items.Add(item);

            item     = new NComboBoxItem("Value");
            item.Tag = "<value>";
            comboBox.Items.Add(item);

            item     = new NComboBoxItem("Label");
            item.Tag = "<label>";
            comboBox.Items.Add(item);

            item     = new NComboBoxItem("Size");
            item.Tag = "<size>";
            comboBox.Items.Add(item);

            return(comboBox);
        }
Ejemplo n.º 10
0
        private static NComboBoxItem CreateFontSizeComboBoxItem(int fontSize)
        {
            NComboBoxItem item = new NComboBoxItem(fontSize.ToString(CultureInfo.InvariantCulture));

            return(item);
        }