/// <summary>
 /// Generates a ItemSelected event to indicate the item has been clicked
 /// </summary>
 /// <param name="sender">Event source object</param>
 /// <param name="args">Event arguments</param>
 protected virtual void RaiseItemSelected(object sender, ItemViewerEventArgs args)
 {
     if (ItemSelected != null)
     {
         ItemSelected(this, args);
     }
 }
 /// <summary>
 /// Generates a DoubleClick event to indicate the item has been double-clicked
 /// </summary>
 /// <param name="sender">Event source object</param>
 /// <param name="args">Event arguments</param>
 protected virtual void RaiseDoubleClick(object sender, ItemViewerEventArgs args)
 {
     if (DoubleClick != null)
     {
         DoubleClick(this, args);
     }
 }
 /// <summary>
 /// Generates a EditingFinished event to indicate the item has finished editing
 /// </summary>
 /// <param name="sender">Event source object</param>
 /// <param name="args">Event arguments</param>
 protected virtual void RaiseEditingFinished(object sender, ItemViewerEventArgs args)
 {
     if (EditingFinished != null)
     {
         EditingFinished(this, args);
     }
 }
        /// <summary>
        /// This event handler is called when an item is selected
        /// </summary>
        /// <param name="sender">Event source object</param>
        /// <param name="e">Event arguments</param>
        private void ItemViewer_ItemSelected(object sender, ItemViewerEventArgs e)
        {
            if (Selected != null && Selected != sender)
            {
                _ticksSinceLastClick = 0;
                if (Selected.IsEditable)
                {
                    Selected.IsEditable = false;
                }
            }

            Selected = (ItemViewerItem)sender;

            if (_ticksSinceLastClick > 0 && _ticksSinceLastClick < 15 && sender == Selected)
            {   // Double-click
                RaiseDoubleClick(this, e);
            }
            else if (_ticksSinceLastClick > 0 && _ticksSinceLastClick < 40 && sender == Selected)
            {   // Slow double-click
                RaiseSlowDoubleClick(this, e);
            }
            else
            {
                RaiseItemSelected(this, e);
            }

            _ticksSinceLastClick = 0;
        }
Beispiel #5
0
        private void ElementViewer_ItemSelected(object sender, ItemViewerEventArgs e)
        {
            _selected = ((ColorItem)ElementViewer.Selected).Color;
            ElementSelectedColor.Background = new SolidColorBrush(_selected);
            ClearSelectedCustom();

            RaiseSelectionChanged(this, new EventArgs());

            _dropDown.IsOpen = false;
        }
        protected void ItemViewerItem_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ItemViewerEventArgs args = new ItemViewerEventArgs()
            {
                Title = _text
            };

            _selected = true;
            _hovering = false;
            UpdateVisualState();

            RaiseItemSelected(this, args);
        }
Beispiel #7
0
        private void item_ItemSelected(object sender, ItemViewerEventArgs e)
        {
            if (ElementCustom != null)
            {
                _selected = ((ColorItem)sender).Color;
                ElementSelectedColor.Background = new SolidColorBrush(_selected);

                foreach (ColorItem item in ElementCustom.Children)
                {
                    if (item.IsSelected && item != sender)
                    {
                        item.IsSelected = false;
                    }
                }

                ElementViewer.Selected = null;

                RaiseSelectionChanged(this, new EventArgs());
                _dropDown.IsOpen = false;
            }
        }