Esempio n. 1
0
 protected virtual void OnSelectionChanging(SelectionChangingEventArgs e)
 {
     if (SelectionChanging != null)
     {
         SelectionChanging(this, e);
     }
 }
Esempio n. 2
0
 private void OnSelectionChanged(object sender, SelectionChangingEventArgs <ALogSummaryVm> e)
 {
     // Auto scroll
     Dispatcher.BeginInvoke(new Action(() =>
     {
         xamlDataGrid.SelectedItem = e.SelectedItem;
         var scrollViewer          = xamlDataGrid.FindChild <ScrollViewer>("DG_ScrollViewer");
         var itemsCount            = xamlDataGrid.Items.Count;
         if (itemsCount > 0)
         {
             var ratio           = e.SelectedIndex / (double)itemsCount;
             var itemPosition    = ratio * (scrollViewer.ScrollableHeight + scrollViewer.ViewportHeight);
             var currentPosition = scrollViewer.VerticalOffset;
             if (currentPosition < itemPosition &&
                 itemPosition < (currentPosition + scrollViewer.ViewportHeight))
             {
                 // no need to scroll
             }
             else if (currentPosition < itemPosition)
             {
                 scrollViewer.ScrollToVerticalOffset(
                     itemPosition - scrollViewer.ViewportHeight + xamlDataGrid.RowHeight);
             }
             else
             {
                 scrollViewer.ScrollToVerticalOffset(itemPosition);
             }
         }
     }));
 }
 private void AssociatedObjectSelectionChanging(object sender, SelectionChangingEventArgs e)
 {
     e.Cancel = false;
     if (CanCancel != null)
     {
         e.Cancel = CanCancel();
     }
 }
Esempio n. 4
0
        void cellgrid_SelectionChanging(object sender, SelectionChangingEventArgs args)
        {
            if (disableCell && args.ActiveRange.Contains(GridRangeInfo.Cell(3, 3)))
            {
                args.Cancel = true;
            }

            eventsTxtBox.Text += "\nSelection changing";
        }
            /// <summary>
            /// Invokes the selection changing.
            /// </summary>
            /// <param name="e">The <see cref="SelectionChangingEventArgs"/> instance containing the event data.</param>
            protected void InvokeSelectionChanging(SelectionChangingEventArgs e)
            {
                EventHandler <SelectionChangingEventArgs> handler = SelectionChanging;

                if (handler != null)
                {
                    handler(this, e);
                }
            }
Esempio n. 6
0
    private void InternalSelectionChanged(Object s, SelectionChangedEventArgs e)
    {
        var args = new SelectionChangingEventArgs();

        OnSelectionChanging(args);
        if (args.Cancel)
        {
            return;
        }
        OnSelectionChanged(e);
    }
            private bool HandleItemSelectionChanged(TItem item, bool isSelecting)
            {
                using (_selectionManagement.Raise())
                {
                    if (_selectionManagement.IsLocked)
                    {
                        return(false);
                    }

                    if (_selectedItems.Contains(item) && isSelecting)
                    {
                        //redundant call, skip
                        return(true);
                    }

                    var args = new SelectionChangingEventArgs(item, isSelecting);
                    InvokeSelectionChanging(args);
                    if (args.Cancel)
                    {
                        //cancel selection change
                        item.IsSelected = !isSelecting;
                        return(false);
                    }

                    if (isSelecting)
                    {
                        if (((uint)_selectionMode & SingleSelectionMask) != 0)
                        {
                            _selectedItems.ForEach(a =>
                            {
                                a.IsSelected = false;
                            });
                            _selectedItems.Clear();
                        }
                        _selectedItems.Add(item);
                        item.IsSelected = true;
                    }
                    else
                    {
                        _selectedItems.Remove(item);
                        item.IsSelected = false;

                        if (IsSelectionRequired && _selectedItems.Count == 0 && Count > 0)
                        {
                            _selectedItems.Add(this[0]);
                            item.IsSelected = true;
                        }
                    }

                    InvokeSelectionChanged(new EventArgs());
                    NotifyOfPropertyChange(() => SelectedItem);
                    return(true);
                }
            }
Esempio n. 8
0
        private void GrdBanksSelectionChanging(object sender, SelectionChangingEventArgs e)
        {
            shouldMoveToFirst = true;
            var currentItem = (e.Source as RadGridView).SelectedItem as OwnerDataModel;

            if (currentItem != null && currentItem.IsDirty && !shouldMoveToPrevious)
            {
                shouldMoveToFirst = false;
                manageOwnersViewModel.ConfirmChangesAsync(currentItem, true, false);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// eq filter selected changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void eqcombox_SelectionChanging(object sender, SelectionChangingEventArgs e) //eq type
        {
            //  e.Cancel = true;
            TComboBox cbx         = sender as TComboBox;
            int       eindex      = cbx.iTg;
            int       filterindex = cbx.SelectedIndex;

            m_eqEdit[eindex].eq_Filterindex = (byte)filterindex;
            if (onEQControlChangedEvent != null)
            {
                onEQControlChangedEvent(this, eindex);
            }
        }
        private bool FireSelectionChangingAndSeeIfShouldCancel(object oldItem, object newItem)
        {
            if (SelectionChanging != null)
            {
                var changingArgs = new SelectionChangingEventArgs(_selectedItem, newItem);
                SelectionChanging(this, changingArgs);
                if (changingArgs.Cancel)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 11
0
 public void OnSelectionChanging(SelectionChangingEventArgs e)
 {
     if (_supress || SelectionChanging == null)
     {
         return;
     }
     // Invoke user event handler and revert to
     // last selected index if user cancels the change
     SelectionChanging(this, e);
     if (e.Cancel)
     {
         _suppress     = true;
         SelectedIndex = _lastIndex;
         _suppress     = false;
     }
 }
Esempio n. 12
0
    public void OnSelectionChanging(SelectionChangingEventArgs e)
    {
        if (_suppress)
        {
            return;
        }

        // Recall the last SelectedIndex before raising SelectionChanging
        _lastIndex = (_index >= 0) ? _index : SelectedIndex;
        if (SelectionChanging == null)
        {
            return;
        }
        // Invoke user event handler and revert to last
        // selected index if user cancels the change
        SelectionChanging(this, e);
        if (e.Cancel)
        {
            _suppress     = true;
            SelectedIndex = _lastIndex;
            _suppress     = false;
        }
    }
 private void RadDataBoundListBox_OnSelectionChanging(object sender, SelectionChangingEventArgs e)
 {
     e.Cancel = true;
 }
 private void RadDataBoundListBox_OnSelectionChanging(object sender, SelectionChangingEventArgs e)
 {
     e.Cancel = true;
 }
 private void ItemsControl_OnSelectionChanging(object sender, SelectionChangingEventArgs e)
 {
     e.Cancel = true;
 }
Esempio n. 16
0
 private void ItemsControl_OnSelectionChanging(object sender, SelectionChangingEventArgs e)
 {
     e.Cancel = true;
 }