本文整理汇总了C#中System.Windows.Controls.DataGridCellEditEndingEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataGridCellEditEndingEventArgs类的具体用法?C# DataGridCellEditEndingEventArgs怎么用?C# DataGridCellEditEndingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridCellEditEndingEventArgs类属于System.Windows.Controls命名空间,在下文中一共展示了DataGridCellEditEndingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentRow
private List<object> GetCurrentRow(DataGridCellEditEndingEventArgs e)
{
List<object> values = new List<object>();
foreach (object item in (MainDataGrid.SelectedItem as DataRowView).Row.ItemArray)
{
values.Add(item);
}
string name = e.Column.Header.ToString();
string value = (e.EditingElement as TextBox).Text;
for (int i = 0; i < MainDataGrid.Columns.Count; i++)
{
if (MainDataGrid.Columns[i].Header.ToString() == name)
{
values[i] = value;
break;
}
}
return values;
}
示例2: DataGrid_CellEditEnding
private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.EditingElement is TextBox)
{
((TextBox)e.EditingElement).Text = ((TextBox)e.EditingElement).Text.Replace("\b", "");
}
}
示例3: productSaleOrderGrid_CellEditEnding
private void productSaleOrderGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
DataGrid grid = (DataGrid)sender;
Popup productSelector = (Popup)grid.FindName("productSelector");
productSelector.IsOpen = false;
}
示例4: SubjectTeacher_DG_CellEditEnding
private void SubjectTeacher_DG_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.Column is DataGridTemplateColumn)
{
BindingOperations.ClearAllBindings(e.EditingElement as ContentPresenter);
}
}
示例5: OnCellEditEnding
protected override void OnCellEditEnding(DataGridCellEditEndingEventArgs e)
{
continueEdit = e.EditAction == DataGridEditAction.Commit;
Log.DebugFormat("OnCellEditEnding(EditAction = {0})", e.EditAction);
Log.DebugFormat(" continueEdit={0}, isNewItem={1}", continueEdit, isNewItemForContinueEdit);
base.OnCellEditEnding(e);
}
示例6: dgEmp_CellEditEnding
/// <summary>
/// Read Data entered in each Cell
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void dgEmp_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
try
{
FrameworkElement eleEno = dgEmp.Columns[0].GetCellContent(e.Row);
if (eleEno.GetType() == typeof(TextBox))
{
emp.EmpNo = Convert.ToInt32(((TextBox)eleEno).Text);
}
FrameworkElement eleEname = dgEmp.Columns[1].GetCellContent(e.Row);
if (eleEname.GetType() == typeof(TextBox))
{
emp.EmpName = ((TextBox)eleEname).Text;
}
FrameworkElement eleSal = dgEmp.Columns[2].GetCellContent(e.Row);
if (eleSal.GetType() == typeof(TextBox))
{
emp.Salary = Convert.ToInt32(((TextBox)eleSal).Text);
}
FrameworkElement eleDname = dgEmp.Columns[3].GetCellContent(e.Row);
if (eleDname.GetType() == typeof(TextBox))
{
emp.DeptName = ((TextBox)eleDname).Text;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例7: dataGrid_CellEditEnding
private void dataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (count != standard.Subjects.Count)
{
count = standard.Subjects.Count;
Analyse();
}
}
示例8: check_showDataGrid_CellEditEnding
private void check_showDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
}
示例9: ColumnListBox_CellEditEnding
private void ColumnListBox_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (e.Column.Header as String == "EnumName")
{
var tx = e.EditingElement as TextBox;
this.SetEnumNameToStoredProcedure(tx.Text);
}
}
示例10: dg_CellEditEnding
void dg_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
var fff= e.Column.GetCellContent(e.Row);
if (fff != null && fff.BindingGroup != null && fff.BindingGroup.Items.Count > 0)
{
bool flag= fff.BindingGroup.CommitEdit();
Console.WriteLine(flag);
}
}
示例11: GridOnCellEditEnding
private void GridOnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
if (_displayIndexCommiting)
return;
if (!ReferenceEquals(e.Column, ColumnDisplayIndex))
return;
if (e.EditAction != DataGridEditAction.Commit)
return;
_displayIndexCommiting = true;
bool commited = Grid.CommitEdit(DataGridEditingUnit.Row, true);
_displayIndexCommiting = false;
if (!commited)
return;
var editedItem = (GridColumnSettings)e.Row.Item;
_newDisplayIndex = editedItem.DisplayIndex;
if (_newDisplayIndex < 0)
{
_newDisplayIndex = 0;
editedItem.DisplayIndex = _newDisplayIndex;
}
else if (_newDisplayIndex >= Grid.Items.Count)
{
_newDisplayIndex = Grid.Items.Count - 1;
editedItem.DisplayIndex = _newDisplayIndex;
}
if (_oldDisplayIndex < _newDisplayIndex)
{
foreach (GridColumnSettings item in Grid.Items)
{
if (ReferenceEquals(item, editedItem))
continue;
if (item.DisplayIndex >= _oldDisplayIndex + 1 && item.DisplayIndex <= _newDisplayIndex)
item.DisplayIndex -= 1;
}
}
else
{
foreach (GridColumnSettings item in Grid.Items)
{
if (ReferenceEquals(item, editedItem))
continue;
if (item.DisplayIndex >= _newDisplayIndex && item.DisplayIndex <= _oldDisplayIndex - 1)
item.DisplayIndex += 1;
}
}
Grid.UpdateTarget(ItemsControl.ItemsSourceProperty);
}
示例12: employeeDataGrid_CellEditEnding
private void employeeDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
var employee = e.Row.Item as Employee;
if (employee != null)
{
switch (e.Column.Header.ToString())
{
case "First Name":
{
var textBox = e.EditingElement as TextBox;
employee.FirstName = textBox.Text;
break;
}
case "Last Name":
{
var textBox = e.EditingElement as TextBox;
employee.LastName = textBox.Text;
break;
}
case "Email":
{
var textBox = e.EditingElement as TextBox;
if (Regex.IsMatch(textBox.Text,
@"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$",
RegexOptions.IgnoreCase))
{
employee.Email = textBox.Text;
}
else
{
MessageBox.Show("Invalid email fromat!");
textBox.Text = employee.Email;
}
break;
}
case "Birth Date":
{
var datePicker = VisualTreeHelper.GetChild(e.EditingElement, 0) as DatePicker;
if (datePicker.SelectedDate < DateTime.Now
&& datePicker.SelectedDate != null)
{
employee.BirthDate = (DateTime)datePicker.SelectedDate;
}
else
{
MessageBox.Show("Invalid date provided!");
datePicker.SelectedDate = employee.BirthDate;
}
break;
}
default:
break;
}
}
}
示例13: StreamDG_CellEditEnding
private void StreamDG_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
DataRowView rowView = e.Row.Item as DataRowView;
rowBeingEdited = rowView;
if (e.Column is DataGridTemplateColumn)
{
BindingOperations.ClearAllBindings(e.EditingElement as ContentPresenter);
}
}
示例14: LinkDataGrid_CellEditEnding
private void LinkDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
var textBox = (TextBox)e.EditingElement;
var composition = (Composition)DataContext;
var url = textBox.Text;
var link = (Link)textBox.DataContext;
link.Compositions.Add(composition);
link.Name = UrlToTitleConverter.UrlToTitle(url);
}
示例15: dgSpares_CellEditEnding
private void dgSpares_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
HandleMainDataGridCellEditEnding(sender, e);
SpareView sv = (SpareView)e.Row.DataContext;
if (sv.id > 0)
if (sv.q_demand.HasValue)
{
sv.demand = (int)sv.q_demand - (int)sv.QRest;
if (sv.demand < 0)
sv.demand = 0;
}
}