Ejemplo n.º 1
0
        void userGrid_MouseClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                IInputElement element = e.MouseDevice.DirectlyOver;
                if (element != null && element is FrameworkElement)
                {
                    if (((FrameworkElement)element).Parent is Microsoft.Windows.Controls.DataGridCell)
                    {
                        var grid = sender as Microsoft.Windows.Controls.DataGrid;
                        if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1)
                        {
                            for (int i = 0; i < grid.Columns.Count; i++)
                            {
                                var item = new Microsoft.Windows.Controls.DataGridCellInfo(grid.Items[grid.SelectedIndex], grid.Columns[0]);
                                var col  = item.Column as Microsoft.Windows.Controls.DataGridColumn;
                                var fc   = col.GetCellContent(item.Item);

                                if (fc is CheckBox)
                                {
                                    CheckBox checkCell = (CheckBox)fc;
                                    if (checkCell != null && checkCell.IsChecked == false)
                                    {
                                        checkCell.IsChecked = true;
                                        var addItemId = (ChargeData)item.Item;
                                        selectUserNameList.Add(addItemId.id);
                                    }
                                    else if (checkCell != null && checkCell.IsChecked == true)
                                    {
                                        checkCell.IsChecked = false;
                                        var delItemId = (ChargeData)item.Item;
                                        selectUserNameList.Remove(delItemId.id);
                                    }
                                }
                            }
                            if (selectUserNameList.Count > 0)
                            {
                                button1.IsEnabled = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string strError = ex.ToString();
                ErrorCollection.GetInstance().SetErrorInfo(strError);
            }
        }
Ejemplo n.º 2
0
                public static DataGridCell GetCell(DataGridCellInfo dataGridCellInfo)
                {
                    if (!dataGridCellInfo.IsValid)
                    {
                        return null;
                    }

                    var cellContent = dataGridCellInfo.Column.GetCellContent(dataGridCellInfo.Item);
                    if (cellContent != null)
                    {
                        return (DataGridCell)cellContent.Parent;

                    }
                    else
                    {
                        return null;
                    }
                }
Ejemplo n.º 3
0
 internal bool EqualsImpl(DataGridCellInfo cell)
 {
     return (cell._item == _item) && (cell._column == _column) && (cell.Owner == Owner);
 }
Ejemplo n.º 4
0
 internal bool EqualsImpl(DataGridCellInfo cell)
 {
     return((cell._item == _item) && (cell._column == _column) && (cell.Owner == Owner));
 }