当前位置: 首页>>代码示例>>C#>>正文


C# DataGrid.UpdateLayout方法代码示例

本文整理汇总了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;
 }
开发者ID:megadrow,项目名称:Study,代码行数:11,代码来源:FindValidationError.cs

示例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(); 
        }
开发者ID:khaledsaied,项目名称:GUI_LABS,代码行数:11,代码来源:MainWindow.xaml.cs

示例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
            {
            }
        }
开发者ID:ohadmanor,项目名称:TDS,代码行数:14,代码来源:DataGridWPFUtility.cs

示例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
     {
     }
 }
开发者ID:ohadmanor,项目名称:TDS,代码行数:16,代码来源:DataGridWPFUtility.cs

示例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;
 }
开发者ID:toschkin,项目名称:MIO,代码行数:12,代码来源:MainWindow.xaml.cs

示例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();
        }
开发者ID:kimchen,项目名称:SalonManager,代码行数:66,代码来源:Printer.cs

示例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]);
        }
开发者ID:burstas,项目名称:rmps,代码行数:25,代码来源:SafeModel.cs


注:本文中的System.Windows.Controls.DataGrid.UpdateLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。