本文整理汇总了C#中System.Windows.Controls.DataGrid.BeginEdit方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.BeginEdit方法的具体用法?C# DataGrid.BeginEdit怎么用?C# DataGrid.BeginEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.DataGrid
的用法示例。
在下文中一共展示了DataGrid.BeginEdit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: service_GetTableDataCompleted
//.........这里部分代码省略.........
var pagerup = new Button
{
Content = "上一页",
Tag = table.TableName,
Margin = new Thickness(20, 0, 0, 0),
IsEnabled = false,
};
var pagerdown = new Button
{
Content = "下一页",
Tag = table.TableName,
Margin = new Thickness(20, 0, 0, 0),
};
pager2Panel.Children.Add(pagershow);
pager2Panel.Children.Add(pagertop);
pager2Panel.Children.Add(pagerup);
pager2Panel.Children.Add(pagerdown);
pagerdown.Click += new RoutedEventHandler(pagerdown_Click);
pagerup.Click += new RoutedEventHandler(pagerup_Click);
pagertop.Click += new RoutedEventHandler(pagertop_Click);
var grid = new DataGrid()
{
AutoGenerateColumns = true,
ItemsSource = enties,
SelectionMode = DataGridSelectionMode.Single,
Tag = table,
IsReadOnly = false,
MaxColumnWidth = 600,
MaxHeight = 600,
};
grid.BeginEdit();
//再是表格
panel.Children.Add(grid);
//最后是下面的分页
panel.Children.Add(pager2Panel);
tab.Content = panel;
}
ListGridTab.Items.Add(tab);
}
//查看到最后一页时,提示并使按键灰掉
else
{
if (data.Count == 0)
{
MessageBox.Show("已是最后一页");
var tab = ListGridTab.Items.Cast<TabItem>().FirstOrDefault(t => (string)t.Tag == tableName.ToString());
var panel = tab.Content as StackPanel;
panel.Children.OfType<StackPanel>().ToList().ForEach(member =>
{
member.Children.OfType<Button>().ToList().ForEach(a =>
{
if (a.Content.ToString() == "下一页")
{
a.IsEnabled = false;
}
if (pageIndex[tableName] == 1)
{
if (a.Content.ToString() == "首页")
{
a.IsEnabled = false;
}
if (a.Content.ToString() == "上一页")