コード例 #1
0
        protected override NWidget CreateExampleContent()
        {
            // create a view and get its grid
            NTableGridView view = new NTableGridView();
            NTableGrid     grid = view.Grid;

            grid.AllowEdit = true;

            // create persons order data source
            NDataSource personOrders = NDummyDataSource.CreatePersonsOrdersDataSource();

            // get the min and max price. We will use it in the progress bars.
            object min, max;

            personOrders.TryGetMin("Price", out min);
            personOrders.TryGetMax("Price", out max);

            grid.AutoCreateColumn += delegate(NAutoCreateColumnEventArgs args)
            {
                if (args.FieldInfo.Name == "Price")
                {
                    // create a progress bar column format for the Price field
                    NSliderColumnEditor sliderColumnEditor = new NSliderColumnEditor();
                    args.DataColumn.Editor     = sliderColumnEditor;
                    args.DataColumn.WidthMode  = ENColumnWidthMode.Fixed;
                    args.DataColumn.FixedWidth = 150;
                }
            };

            grid.DataSource = personOrders;
            return(view);
        }
コード例 #2
0
        protected override NWidget CreateExampleContent()
        {
            // create a view and get its grid
            NTableGridView view = new NTableGridView();
            NTableGrid     grid = view.Grid;

            // create persons order data source
            NDataSource personOrders = NDummyDataSource.CreatePersonsOrdersDataSource();

            // get the min and max price. We will use it in the progress bars.
            object min, max;

            personOrders.TryGetMin("Price", out min);
            personOrders.TryGetMax("Price", out max);

            grid.AutoCreateColumn += delegate(NAutoCreateColumnEventArgs args)
            {
                if (args.FieldInfo.Name == "Price")
                {
                    // create a progress bar column format for the Price field
                    NProgressBarColumnFormat progressBarColumnFormat = new NProgressBarColumnFormat();
                    progressBarColumnFormat.Minimum = Convert.ToDouble(min);
                    progressBarColumnFormat.Maximum = Convert.ToDouble(max);
                    args.DataColumn.Format          = progressBarColumnFormat;
                }
            };

            grid.DataSource = NDummyDataSource.CreatePersonsOrdersDataSource();
            return(view);
        }