I have built a WPF app that has a dynamic legend that is refreshed as a user toggles on/off a layers visibility. I would like the identify task to only identify layers that are visible in the legend control ( legend is in tree view).

Is this possible?

Right now the identify task is based on the URL provided in the identify task constructor. The service URL that the identify task consumes has some layers off and other layers turned on but the user has the ability to turn on/off layers in the table of contents. This allows the user to turn off all the layers in the legend and still identify features