/// <summary>
        /// Initializes a new instance of the <see cref="ViewModel"/> class.
        /// </summary>
        public ViewModel()
        {
            OrderInfoRepository order = new OrderInfoRepository();

            OrdersDetails = order.GetOrdersDetails(100);
        }
Exemple #2
0
        /// <summary>
        /// Sets the sample customization settings.
        /// </summary>
        private void SampleCustomization()
        {
            OrderInfoRepository order        = new OrderInfoRepository();
            List <OrderInfo>    orderDetails = order.GetOrdersDetails(100);

            this.sfDataGrid1.DataSource = orderDetails;
            childGrid = new SfDataGrid();
            GridViewDefinition orderDetailsView = new GridViewDefinition();

            orderDetailsView.RelationalColumn = "OrderDetails";


            GridViewDefinition employeeDetailsView = new GridViewDefinition();

            employeeDetailsView.RelationalColumn = "EmployeeDetails";

            childGrid.AutoGenerateColumns = false;
            childGrid.RowHeight           = 21;
            NumberFormatInfo nfi = new NumberFormatInfo();

            nfi.NumberDecimalDigits = 0;
            nfi.NumberGroupSizes    = new int[] { };
            childGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID", NumberFormatInfo = nfi
            });
            childGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "ProductID", HeaderText = "Product ID", NumberFormatInfo = nfi
            });
            childGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "UnitPrice", HeaderText = "Unit Price", FormatMode = FormatMode.Currency
            });
            childGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Quantity"
            });
            childGrid.Columns.Add(new GridNumericColumn()
            {
                MappingName = "Discount", FormatMode = Syncfusion.WinForms.Input.Enums.FormatMode.Percent
            });
            childGrid.Columns.Add(new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            });
            childGrid.Columns.Add(new GridDateTimeColumn()
            {
                MappingName = "OrderDate", HeaderText = "Order Date"
            });

            childGrid.DetailsViewDefinitions.Add(employeeDetailsView);

            orderDetailsView.DataGrid = childGrid;

            this.sfDataGrid1.DetailsViewDefinitions.Add(orderDetailsView);

            this.sfDataGrid1.ExpandAllDetailsView();

            btnGetCellValue.Click += BtnGetCellValue_Click;

            (this.sfDataGrid1.DetailsViewDefinitions[0] as GridViewDefinition).DataGrid.CellClick += DataGrid_CellClick;

            (this.childGrid.DetailsViewDefinitions[0] as GridViewDefinition).DataGrid.CellClick += childGrid_CellClick;
        }