Sunday, August 26, 2012

How to find control in usercontrol from PropertyChangedCallback method?

How to find control in usercontrol from PropertyChangedCallback method?

I have this code in MyControl.cs:

public static myMethod(DependencyObject d, DependencyPropertyChangedEventArgs e) {     MyControl control = d as MyControl;     AnotherControl a = control.Findname("blabla") as AnotherControl; } 

The problem is that code control.Findname("blabla") returns null, despite that the control named "blabla" exists in my usercontrol's XAML. How to access it?

Accessing it by control.blabla is not the solution, because I have controls named blabla1, blabla2, blabla3 and I have to modify them in a loop.

EDIT: Maybe it's relevant that everything happens in WP7 environment?

Answers & Comments...

Answer: 1

OK, I got my answer: http://abubakar-dar.blogspot.com/2010/09/find-control-inside-silverlight.html

by : Andrzejhttp://stackoverflow.com/users/1483626




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog