Home
Manage Your Code
Snippet: Using the IActiveViewEvents_SelectionChangedEventHandler (C#)
Title: Using the IActiveViewEvents_SelectionChangedEventHandler Language: C#
Description: Similar to the IEditEvents_OnSelectionChangedEvent Sample is the IActiveViewEvents_SelectionChangedEventHandler Views: 126
Author: Hans Bampel Date Added: 10/22/2007
Copy Code  
1public class CommandAddWorkItem : ...Command...
2{
3	private IActiveViewEvents_SelectionChangedEventHandler _activeViewEvents_SelectionChangedEventHandler = null;
4
5	private void WireEvents()
6        {
7            Map map = .. as Map;
8            if (null != map)
9            {
10                _activeViewEvents_SelectionChangedEventHandler = this.OnSelectionChanged;
11                map.SelectionChanged += _activeViewEvents_SelectionChangedEventHandler;
12            }
13
14            this.Click += new EventHandler(OnClick);
15        }
16
17	private void OnSelectionChanged()
18	{
19		_msg.Debug("OnSelectionChanged");
20
21		Map map = .. as Map;
22		_enabled = (map != null) && (map.SelectionCount > 0)
23
24	private void OnClick(object sender, EventArgs e)
25	{
26		_msg.Debug("OnClick");
27		..blabla..
28	}
Usage
use it like in the sample ...