Thanks for that. I can see how getting a child control by name would make things much cleaner. I like the look of the links to Jonas's blog that Jordan posted. I came from WPF before I worked with Silverlight and used commands then. Will see if I can implement that for my project. He also explains MVVM in an easy to understand way (and the diagram really helps). I often wonder what pattern I'm following but if I don't know then I'm probably not following any. :)
Love seeing areas I can improve in, makes it all much more fun/satisfying. cheers, Stephen On Thu, Mar 12, 2009 at 9:06 PM, Miguel Madero <[email protected]> wrote: > It's somewhat problematic to navigate the VisualTree. Sometimes even > looking at the XAML isn't evident which controll will be the parent as you > would need not only to know your XAML, but also the ControlTemplates the > define the controls that you're using. > A while ago I created some extensions for the VisualStateManager that can > help in this and other types of scenarios. > > You can see part > 1<http://miguelmadero.blogspot.com/2008/07/use-visualtreehelper-to-navigate.html> > and part > 2<http://miguelmadero.blogspot.com/2008/07/use-visualtreehelper-to-navigate_18.html> > > > For this escenario with the Extension method we could use the following > syntax: > > ListBoxItem lbi = button.GetParent<ListBoxItem>(); > > The code is available in my blog. I've added a couple more methods, if you > find it interesting, just e-mail me and I can send you the updated version. > ------------------------------ > Support procedure: https://www.codify.com/lists/support > List address: [email protected] > Subscribe: [email protected] > Unsubscribe: [email protected] > List FAQ: http://www.codify.com/lists/ozsilverlight > Other lists you might want to join: http://www.codify.com/lists > -------------------------------------------------------------------------------- Support procedure: https://www.codify.com/lists/support List address: [email protected] Subscribe: [email protected] Unsubscribe: [email protected] List FAQ: http://www.codify.com/lists/ozsilverlight Other lists you might want to join: http://www.codify.com/lists
