Exemplo n.º 1
0
        private void SyncCurrentColumn(DiffDataGridControl destControl)
        {
            var destCurrentColumn = destControl.GlobalCurrentColumn;

            if (destCurrentColumn == null)
            {
                return;
            }

            var dataContext = this.FindContext(destControl.CurrentContext);

            if (dataContext == null)
            {
                return;
            }

            using (destControl.preventEvent.Set(true))
            {
                if (destCurrentColumn == null)
                {
                    dataContext.CurrentColumn = null;
                }
                else
                {
                    dataContext.CurrentColumn = dataContext.Columns[destCurrentColumn.FieldName];
                }
            }
        }
Exemplo n.º 2
0
        private void SyncSelection(DiffDataGridControl destControl)
        {
            using (destControl.preventSelection.Set(true))
            {
                {
                    this.SelectedItemRanges.Clear();
                    foreach (var item in DataGridControl.GetDataGridContext(this).GetChildContexts())
                    {
                        item.SelectedItemRanges.Clear();
                    }
                }

                if (destControl.GlobalCurrentItem != null)
                {
                    var destContext = DataGridControl.GetDataGridContext(destControl);
                    Select(destContext);

                    foreach (var item in destContext.GetChildContexts())
                    {
                        Select(item);
                    }
                }
            }

            void Select(DataGridContext destContext)
            {
                var gridContext = this.FindContext(destContext);
                var query       = from item in destContext.GetSelectedItems()
                                  let obj = this.FindItem(gridContext.Items, DiffUtility.GetItemKey(item))
                                            where obj != null
                                            select obj;

                if (query.Count() == destContext.GetSelectedItems().Count())
                {
                    var selectionRanges = gridContext.GenerateSelectionRanges(query);
                    foreach (var item in selectionRanges)
                    {
                        gridContext.SelectedItemRanges.Add(item);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void SyncCurrentItem(DiffDataGridControl destControl)
        {
            var destCurrentItem = destControl.GlobalCurrentItem;

            if (destCurrentItem == null)
            {
                return;
            }

            var dataContext = this.FindContext(destControl.CurrentContext);

            if (dataContext == null)
            {
                return;
            }

            using (destControl.preventEvent.Set(true))
            {
                dataContext.CurrentItem = this.FindItem(dataContext.Items, DiffUtility.GetItemKey(destControl.GlobalCurrentItem));
            }
        }