本文整理汇总了C#中System.Windows.Controls.DataGrid.UpdateLayout方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.UpdateLayout方法的具体用法?C# DataGrid.UpdateLayout怎么用?C# DataGrid.UpdateLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.DataGrid
的用法示例。
在下文中一共展示了DataGrid.UpdateLayout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRow
private static DataGridRow GetRow(DataGrid grid, int index)
{
var row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
if (row == null)
{
grid.UpdateLayout();
grid.ScrollIntoView(grid.Items[index]);
row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
}
return row;
}
示例2: ResizeWindow
void ResizeWindow(DataGrid grid)
{
grid.MaxHeight = MyWindow.ActualHeight;
if (grid.MaxHeight > 400)
grid.MaxHeight = grid.MaxHeight - 100;
grid.UpdateLayout();
//MyWindow.gridAgents.MaxHeight = grid.MaxHeight;
//MyWindow.gridAgents.UpdateLayout();
}
示例3: DataGridGotoByIndex
public static void DataGridGotoByIndex(DataGrid dtGrid, int index)
{
try
{
if (index < 0 || index > (dtGrid.Items.Count - 1)) return;
dtGrid.SelectedItem = dtGrid.Items[index];
dtGrid.UpdateLayout();
dtGrid.ScrollIntoView(dtGrid.SelectedItem);
}
catch
{
}
}
示例4: DataGridGotoLast
public static void DataGridGotoLast(DataGrid dtGrid)
{
try
{
int index = dtGrid.Items.Count - 1;
if (index >= 0)
{
dtGrid.SelectedItem = dtGrid.Items[index];
dtGrid.UpdateLayout();
dtGrid.ScrollIntoView(dtGrid.SelectedItem);
}
}
catch
{
}
}
示例5: GetRow
public static DataGridRow GetRow(DataGrid grid, int index)
{
DataGridRow row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
if (row == null)
{
// May be virtualized, bring into view and try again.
grid.UpdateLayout();
grid.ScrollIntoView(grid.Items[index]);
row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index);
}
return row;
}
示例6: print
public static void print(DataGrid grid)
{
// FlowDocument doc = new FlowDocument();
//FixedDocument fixedDoc = new FixedDocument();
//PageContent pageContent = new PageContent();
//FixedPage fixedPage = new FixedPage();
//fixedPage.Children.Add(grid);
//((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);
//fixedDoc.Pages.Add(pageContent);
//PrintWindow pWin = new PrintWindow();
//pWin.SetDoc(fixedDoc);
//pWin.ShowDialog();
PrintDialog pDialog = new PrintDialog();
pDialog.PageRangeSelection = PageRangeSelection.AllPages;
pDialog.UserPageRangeEnabled = true;
double HorizontalOffset = 20;
double VerticalOffset = 20;
double oriHeight = grid.Height;
double oriWidth = grid.Width;
grid.Height = Double.NaN;
if (grid.Width > pDialog.PrintableAreaWidth - HorizontalOffset)
{
grid.Width = pDialog.PrintableAreaWidth - HorizontalOffset;
}
grid.UpdateLayout();
Nullable<Boolean> print = pDialog.ShowDialog();
if (print == true)
{
string title = "KimWorks-SalonManager";
grid.Measure(new Size(Double.PositiveInfinity,Double.PositiveInfinity));
Size sizeGrid = grid.DesiredSize;
Point ptGrid = new Point(HorizontalOffset, VerticalOffset);
grid.Arrange(new Rect(ptGrid, sizeGrid));
pDialog.PrintVisual(grid, title);
double diff;
int i = 1;
while ((diff = sizeGrid.Height - (pDialog.PrintableAreaHeight - VerticalOffset) * i) > 0)
{
//Position of the grid
var ptSecondGrid = new Point(HorizontalOffset, -sizeGrid.Height + diff + VerticalOffset);
// Layout of the grid
grid.Arrange(new Rect(ptSecondGrid, sizeGrid));
//print
int k = i + 1;
pDialog.PrintVisual(grid, title + " (Page " + k + ")");
i++;
}
//Size pageSize = new Size(pDialog.PrintableAreaWidth, pDialog.PrintableAreaHeight);
//grid.Measure(pageSize);
//grid.Arrange(new Rect(5,5,pageSize.Width,pageSize.Width));
//pDialog.PrintVisual(grid, "KimWorks-SalonManager");
}
grid.Height = oriHeight;
grid.Width = oriWidth;
grid.UpdateLayout();
}
示例7: ReBind
/// <summary>
///
/// </summary>
/// <param name="grid"></param>
/// <param name="step"></param>
public void ReBind(DataGrid grid, int step)
{
int idx = grid.SelectedIndex + step;
if (idx < 0)
{
idx = 0;
}
else if (idx >= _AttList.Count)
{
idx = _AttList.Count - 1;
}
grid.ItemsSource = null;
grid.ItemsSource = _AttList;
grid.SelectedIndex = idx;
grid.UpdateLayout();
grid.ScrollIntoView(grid.SelectedItem, grid.Columns[0]);
}