Exemplo n.º 1
0
        void AssociatedObject_ItemsSourceChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
        {
            var table = (this.AssociatedObject.ItemsSource as DataView).Table;

            TOTAL_EMPLOYEES      = (int)table.Compute("COUNT(EmployeeID)", "");
            TOTAL_SICKLEAVEHOURS = (long)table.Compute("SUM(SickLeaveHours)", "");
        }
Exemplo n.º 2
0
 private void Grid_CurrentCellClosedDropDown(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
 {
     if (grid.CurrentCell.IsEditing)
     {
         //To update the cell value
         grid.CurrentCell.EndEdit();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Handles the CurrentCellChanged event of the AssociatedObject control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="args">The <see cref="Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs"/> instance containing the event data.</param>
        void AssociatedObject_CurrentCellChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
        {
            GridDataControl _dataGrid = this.AssociatedObject;
            //Getting the index of VisibleColumn from ColumnIndex of Grid
            var columnIndex = _dataGrid.Model.ResolvePositionToVisibleColumnIndex(_dataGrid.Model.CurrencyManager.CurrentCell.ColumnIndex);

            if (columnIndex >= 0)
            {
                var column      = _dataGrid.Model.TableProperties.VisibleColumns[columnIndex];
                var recordIndex = _dataGrid.Model.CurrencyManager.CurrentRecordIndex;
                //Adding condition check to handle Unbound column values alone
                if (column.MappingName == "Status")
                {
                    var checkbx = _dataGrid.Model.CurrencyManager.CurrentCell.Renderer.CurrentCellUIElement;
                    var key     = (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).CountryName;

                    bool _containsValue = false;
                    _containsValue = UnboundColumnDictionary_dataGrid1.ContainsKey(key);
                    //Updation the checkbox value in dictionary and calculation the summary value based on the check box state
                    if (_containsValue)
                    {
                        UnboundColumnDictionary_dataGrid1[key] = (bool)(checkbx as CheckBox).IsChecked;
                        if ((bool)(checkbx as CheckBox).IsChecked)
                        {
                            PopulationSummary        += (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).Population;
                            AreaSummary              += (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).Area;
                            PopulationDensitySummary += (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).PopulationDensity;
                            if (PopulationDensitySummary < 0)
                            {
                                PopulationDensitySummary = 0;
                            }
                            TotoalCount_dataGrid1 = TotoalCount_dataGrid1 + 1;
                        }
                        else
                        {
                            PopulationSummary        -= (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).Population;
                            AreaSummary              -= (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).Area;
                            PopulationDensitySummary -= (_dataGrid.Model.View.Records[recordIndex].Data as CountryDetails).PopulationDensity;
                            if (PopulationDensitySummary < 0)
                            {
                                PopulationDensitySummary = 0;
                            }
                            TotoalCount_dataGrid1 = TotoalCount_dataGrid1 - 1;
                        }

                        //Invalidation the last Unbound row to refresh with  new summary values
                        _dataGrid.Model.InvalidateCell(GridRangeInfo.Row(_dataGrid.Model.RowCount - 1));
                        _dataGrid.Model.InvalidateCell(GridRangeInfo.Col(0));
                    }
                }
            }
        }
Exemplo n.º 4
0
 void control_ItemsSourceChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)
 {
     CommandParameter = args;
     ExecuteCommand();
 }