Click here to Skip to main content
11,813,543 members (45,237 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# UI Automation
when i use TogglePattern.Toggle() method to select the treeItem,it will be selected,but a few seconds later,the treeItem state become not can i solve this question.can anybody give me an answer?

TogglePattern togPattern = (TogglePattern)treeElementCollection[i].GetCurrentPattern(TogglePattern.Pattern);

if (togPattern.Current.ToggleState == ToggleState.Off)
the code is here,as I just described.
Posted 24-Apr-13 23:51pm
Edited 25-Apr-13 4:18am
Erik Rude at 25-Apr-13 8:07am
try posting some code. Maybe some one will be able to spot the issue.
Try limiting the amount of code to just what makes this behaviour happen.
Sergey Alexandrovich Kryukov at 25-Apr-13 9:40am
This is not what this pattern does (even if you can use it). And why changing the state by time? I don't see any sense in it...
xuyunhai at 25-Apr-13 9:53am
but just these code to select the treeItem.
you can download a tool named bus hound.and choose the "Device" page.
this page contains treeview component.
you can test to select the treeItem use my code.then you will find the problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Abhinav S 275
1 Palash Mondal_ 190
2 KrunalRohit 150
4 Manas_Kumar 115
0 OriginalGriff 3,877
1 KrunalRohit 2,526
2 Maciej Los 2,245
3 CPallini 2,240
4 ppolymorphe 1,750

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 29 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100