/// <summary> /// Property for selectedindex that will trigger Event /// </summary> //public int newindex //{ // get { return _newindex; } // set // { // if (_newindex != value) // { // _newindex = value; // //To make sure we only trigger the event if a handler is present // //we check the event to make sure it's not null. // if (OnSelectionChanged != null) // { // OnSelectionChanged (this, new SelectedEventArgs (newindex)); // } // } // } //} // End class MonitorDataGridSelectionChanges //public class HandleSelectionChange //{ // // We have to Declare our event handler in the class that is going to trigger it // // but it is based on the Delegate declared in the Namespace // // NB we do NOT need to use the args in this declaration // // public event SelectionChanged OnSelectionChanged; // //public HandleSelectionChange () // //{ // // SayDelegate sd = new SayDelegate (showstring); // // sd ("dafsasds"); // //} // public string showstring (string s) // { // return "Hello there - " + s; // } // /// <summary> // /// Now lets test the event contained in the above class. // /// we pass the handler function name as the argument // /// </summary> // MonitorDataGridSelectionChanges MyObject = new MonitorDataGridSelectionChanges (); // // MyObject += new SelectionChanged (IndexChanged); /// <summary> ///This is the actual method that will be assigned to the event handler ///within the above class. This is where we perform an action once the ///event has been triggered. /// </summary> static void OnSelectionChanged(object source, SelectedEventArgs e) { int newindex = e.GetIndex(); // TODO //Changed the current SeletedIndex in Datagrid of interest to us //... }