Skip to content

Triggering Events and Updating Bindings

Sorry for the extended absence… I’m been working myself to the bone on the Veracity submission to the Show Off at MIX08. We’ll have some really kicking stuff to play around with at the Open Space… you should drop by and say hi. I look something like this:

MeAt130

At least I look like that at 1:30 AM.

OK, so I felt the need to pipe up at this ungodly hour with a public service announcement about events and databinding. I just spent a good hour trying to figure out a workaround for this problem. I had a method being called on my “IsVisibleChanged” event. I was planning on take that item and performing some code-behind logic based on the databound Canvas.Left and Canvas.Top properties.

WPF put the smack-down on that action. The data binding wouldn’t update before the event was called. And I couldn’t make it. Not without some kind of Invoke… which, I must admit, scares the ever-loving crap out of me, so I didn’t try… also because I didn’t know how to use it.

My advice if your databinding won’t update? Find some way of going to the data itself. If you’re binding to something in the XAML, you should be able to find the object you’re binding to in the code as well. Just go straight to the source.

Anyone have a better idea or suggestion? I’m totally open to hearing it.