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


C# DataGrid.ScrollIntoView方法代码示例

本文整理汇总了C#中System.Windows.Controls.DataGrid.ScrollIntoView方法的典型用法代码示例。如果您正苦于以下问题:C# DataGrid.ScrollIntoView方法的具体用法?C# DataGrid.ScrollIntoView怎么用?C# DataGrid.ScrollIntoView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.DataGrid的用法示例。


在下文中一共展示了DataGrid.ScrollIntoView方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScrollToEnd

		private static void ScrollToEnd(DataGrid datagrid)
		{
			if (datagrid.Items.Count == 0)
			{
				return;
			}
			datagrid.ScrollIntoView(datagrid.Items[datagrid.Items.Count - 1]);
		}
开发者ID:bchalek,项目名称:ZPOChat,代码行数:8,代码来源:DataGridBehavior.cs

示例2: 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

示例3: GetRow

		static public DataGridRow GetRow(DataGrid dg, int index)
		{
			DataGridRow row = (DataGridRow)dg.ItemContainerGenerator.ContainerFromIndex(index);
			if (row == null)
			{
				// may be virtualized, bring into view and try again
				dg.ScrollIntoView(dg.Items[index]);
				row = (DataGridRow)dg.ItemContainerGenerator.ContainerFromIndex(index);
			}
			return row;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:11,代码来源:DataGridHelper.cs

示例4: ScrollToEnd

        private static void ScrollToEnd(DataGrid datagrid)
        {
            if (datagrid.Items.Count == 0)
                return;

            int index = datagrid.Items.Count - 1;
            object item = datagrid.Items[index];

            //if (datagrid.SelectedIndex != -1 && datagrid.SelectedIndex != index)
            //    return;

            datagrid.ScrollIntoView(item);
            //datagrid.SelectedItem = null;
        }
开发者ID:jbatonnet,项目名称:flowtomator,代码行数:14,代码来源:DataGridBehavior.cs

示例5: 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

示例6: 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

示例7: GetCell

		static public DataGridCell GetCell(DataGrid dg, int row, int column)
		{
			DataGridRow rowContainer = GetRow(dg, row);

			if (rowContainer != null)
			{
				DataGridCellsPresenter presenter = VisualHelper.FindVisualChild<DataGridCellsPresenter>(rowContainer);

				// try to get the cell but it may possibly be virtualized
				DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
				if (cell == null)
				{
					// now try to bring into view and retreive the cell
					dg.ScrollIntoView(rowContainer, dg.Columns[column]);
					cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
				}
				return cell;
			}
			return null;
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:20,代码来源:DataGridHelper.cs

示例8: SelectThisID

		public void SelectThisID (DataGrid ActuallDataGrid, String IDToSelect)
			{
			ActuallDataGrid.SelectedItems.Clear ();
			foreach (Object RowView in ActuallDataGrid.Items)
				{
				if (RowView.GetType () == typeof (DataRowView))
					if (IDToSelect == ((DataRowView)RowView).Row [IDName].ToString ())
						{
						ActuallDataGrid.SelectedItem = RowView;
						try
							{
							int IndexToSelect = ActuallDataGrid.Items.IndexOf ((DataRowView) RowView);
							ActuallDataGrid.ScrollIntoView (IndexToSelect);
							}
						catch (Exception Excp)
							{
							String Message = Excp.ToString();
							}
						break;
						}
				}
			}
开发者ID:heinzsack,项目名称:DEV,代码行数:22,代码来源:TableUserControlHelper.cs

示例9: MakeDataGridRowFocused

 public void MakeDataGridRowFocused(DataGrid dg, int index)
 {
     dg.SelectedItem = dg.Items[index];
     dg.ScrollIntoView(dg.Items[index]);
 }
开发者ID:Sandoryk,项目名称:MVS_projects,代码行数:5,代码来源:SettledListViewModel.cs

示例10: ScrollToSelectedItem

 /// <summary>
 /// Scrolls to the SelectedItem and first column of a given DataGrid
 /// This method must be used as an extension method to the DataGrid class
 /// </summary>
 /// <param name="dataGrid"></param>
 void ScrollToSelectedItem(DataGrid dataGrid)
 {
     if (dataGrid.SelectedItem == null)
     {
         return;
     }
     var itemToScrollTo = dataGrid.SelectedItem;
     var columnToScrolTo = dataGrid.Columns[0];
     dataGrid.ScrollIntoView(itemToScrollTo, columnToScrolTo);
 }
开发者ID:tbmihailov,项目名称:fueltracker-sl-sample,代码行数:15,代码来源:CarEditView.xaml.cs

示例11: RecomputeTotals

        private async Task RecomputeTotals(DataGrid host, DataTableShim tbl)
        {
            if (tbl == null) return;
            await Task.Delay(100);

            var colCount = host.Columns.Count;
            var totals   = new List<decimal?>();
            var isDecimal = new List<bool>();
            var row      = tbl.NewRow();

            for (int j = 0; j < colCount; j++)
            {
                totals.Add((decimal?)null);
                isDecimal.Add(false);
            }

            object firstItem = null;
            foreach (var item in host.ItemsSource)
            {
                if (firstItem == null) firstItem = item;

                if (host.EnableRowVirtualization)
                    host.ScrollIntoView(item);

                for (int j = 0; j < colCount; j++)
                {
                    var cell = host.Columns[j].GetCellContent(item);
                    totals[j] = TryIncrement(j, totals[j], cell, isDecimal);
                }
            }

            for (int j = 0; j < colCount; j++)
            {
                if (totals[j] != null && totals[j].HasValue)
                {
                    var f = isDecimal[j] ? "{0:n2}" : "{0:n0}";
                    row[j] = string.Format(f, totals[j].Value);
                }
            }
            row[0] = "total";
            tbl?.Rows?.Clear();
            if (row != null) tbl?.Rows?.Add(row);
            
            if (host.EnableRowVirtualization && firstItem != null)
            {
                //await Task.Delay(1000 * 2);
                host.ScrollIntoView(firstItem);
            }
        }
开发者ID:peterson1,项目名称:ErrH,代码行数:49,代码来源:DgTotalsRow.xaml.cs

示例12: 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

示例13: 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

示例14: ScrollToEnd

        private static void ScrollToEnd(DataGrid datagrid)
        {
            infoDict[datagrid].Timer.Stop();

            if (datagrid.Items.Count == 0)
            {
                return;
            }
            datagrid.ScrollIntoView(datagrid.Items[datagrid.Items.Count - 1]);
        }
开发者ID:mikel785,项目名称:Logazmic,代码行数:10,代码来源:DataGridBehavior.cs


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