UIElement's Visibility control from different UIElement
I have two UIElement
s X (X.xaml, Name="_X") and Y (Y.xaml, Name="_Y").
How can I control Visibility开发者_运维百科 of Y.xaml from X.xaml.cs?
It's easy to control Visibility
of Y.xaml from Y.xaml.cs, as I can use _Y.Visibility = SOMETHING
, but I don't know how to do that from X.xaml.cs.
This is a common programming question about accessing the properties/members of one class from within another.
You need to grab a hold of a reference to the instance of the class you're trying to access. That depends on how they are created and how they related to each other in terms of object graph. Do they share the same parent, etc?
精彩评论