Beispiel #1
0
 private void add_Click(object sender, RoutedEventArgs e)
 {
     this.items.Add(new ViewModel 
     { 
         Name = textBox.Text, 
         Description = index++.ToString(),
     });
 }
Beispiel #2
0
 private void showPopupButton_Click(object sender, RoutedEventArgs e)
 {
     this.popup.IsOpen = !this.popup.IsOpen;
 }
Beispiel #3
0
 private void remove_Click(object sender, RoutedEventArgs e)
 {
     this.items.RemoveAt(0);
 }
Beispiel #4
0
        private void RaiseEventImpl(RoutedEventArgs e)
        {
            List<Delegate> delegates;

            if (this.eventHandlers.TryGetValue(e.RoutedEvent, out delegates))
            {
                foreach (Delegate handler in delegates)
                {
                    // TODO: Implement the Handled stuff.
                    handler.DynamicInvoke(this, e);
                }
            }
        }
Beispiel #5
0
        private void BubbleEvent(RoutedEventArgs e)
        {
            UIElement target = this;

            while (target != null)
            {
                target.RaiseEventImpl(e);
                target = VisualTreeHelper.GetAncestor<UIElement>(target);
            }
        }
Beispiel #6
0
 public void RaiseEvent(RoutedEventArgs e)
 {
     if (e.RoutedEvent != null)
     {
         switch (e.RoutedEvent.RoutingStrategy)
         {
             case RoutingStrategy.Bubble:
                 this.BubbleEvent(e);
                 break;
             case RoutingStrategy.Direct:
                 this.RaiseEventImpl(e);
                 break;
             default:
                 throw new NotImplementedException();
         }
     }
 }