Archive for Aprile 10th, 2008

method raises the Routed event

CodeKeep C# Feed Aprile 10th, 2008

Description: method raises the Routed event

Link: http://www.codekeep.net/snippets/c9433cac-c4f9-4565-9fac-875672da87a3.aspx

        // This method raises the CancelClick event
        void RaiseCancelClickEvent()
        {
            CancelClickEventArgs newEventArgs = new CancelClickEventArgs();
            RaiseEvent(newEventArgs);
        }

CLR accessors for Routed event

CodeKeep C# Feed Aprile 10th, 2008

Description: CLR accessors for Routed event

Link: http://www.codekeep.net/snippets/6100f92f-686d-49a6-afcf-43d2aa103da9.aspx

        // Provide CLR accessors for the event
        public event RoutedEventHandler CancelClick
        {
            add { AddHandler(CancelClickEvent, value); }
            remove { RemoveHandler(CancelClickEvent, value); }
        }

Custom RoutedEventArgs

CodeKeep C# Feed Aprile 10th, 2008

Description: Custom RoutedEventArgs

Link: http://www.codekeep.net/snippets/ff0e8132-9e32-4212-ba31-ab6989d7c7ea.aspx

    /// <summary>
    /// On click of connections event args
    /// </summary>
    public class PersonPanelCloseClickEventArgs : RoutedEventArgs
    {
        public PersonPanelCloseClickEventArgs()
            : base(PersonPanel.PersonPanelCloseClickEvent)
        {}
    }

RoutedEvent declaration

CodeKeep C# Feed Aprile 10th, 2008

Description: RoutedEvent declaration

Link: http://www.codekeep.net/snippets/d0d88567-ede5-4036-8a8e-b25a65d52f37.aspx

/// <summary>
        /// Routed event to notify connections click action
        /// </summary>
        public static readonly RoutedEvent PersonPanelCloseClickEvent = EventManager.RegisterRoutedEvent(
   "PersonPanelCloseClickEvent", RoutingStrategy.Bubble, typeof(EventHandler<PersonPanelCloseClickEventArgs>), typeof(PersonPanel));