Hi Jose, First, thanks for helping me out. Friday afternoons are tough, so no worries ;)
I'll create a clean little sample to illustrate what I'm trying to do. This is either a common problem, or I'm approaching this from the wrong angle ;) I wan't to trigger animations based on property changes on my data bound object (datacontext). In order to programatically trigger the animations I need to hook the PropertyChanged event, and in order to do that I tried to create a dependency property and bind it the same way I bind the data context. When the dependency property changed callback is executed I invoke an animation, but "nothing happens". I'll send a new post later today with a simple isolated sample :P Have a GREAT weekend! cheers, Jonas On Fri, May 2, 2008 at 5:21 PM, Jose Fajardo <[EMAIL PROTECTED]> wrote: > > Hey mate, > > > I understood most of what you're trying to do, it's the fact that > it's Friday and > my brain is completely fried that I can't work out why it's not working > for ya. > > > Correct me if im wrong here BUT what your saying is that the newly > created dependency > property is not being triggered when an animation runs.. Correct? > > > If so what triggers this animation, what is it that is actually > calling the animation > in the first place ? > > > Regards Jose > > > > > ======================================= > > > > > Hi Jose, > > And thanks for the link. I have implemented the INotifyPropertyChanged > event on > my bussiness object SilverlightOrder. > > This is the problem: > > 1) I have a list of orders: List > 2) I set the list as the DataContext on a ListView control > 3) The ListView control creates one user control for each SilverlightOrder > object, > and passes on the SilverlightOrder object to the user controls DataContext > property > > 4) Inside the user control I wan't to listen to the PropertyChanged event > on the > SilverlightOrder objekt. How ever, since I can't override the DataContext > property > on my user control, I don't get access to the SilverlightOrder object in > order to > hook up the event... > > > I tried making a DependencyProperty on my user control called order like > this: > > > public static readonly DependencyProperty OrderProperty = > DependencyProperty.Register("Order", typeof(SilverlightOrder), > typeof(OrderStatusLine), > new PropertyChangedCallback(DepCallback)); > > > > And then bind it the same way I bind the DataContext property: > > > > The DepCallback method do execute, but if I run an animation on the > control (which > get's passed as the DependencyObject property) nothing happens... It's > allmost like > I change the state "to early"...? > > > public static void DepCallback(DependencyObject obj, > DependencyPropertyChangedEventArgs > e) > { > ((OrderStatusLine)obj).SetInitialStateBasedOnData(); > } > > > So, yeah, I deffenetly wan't to hook the PropertyChanged event of my data > bound > object and run animations based on any changes... But, I haven't figured > out how > to hook the event up.. :P > > > cheers, > Jonas > > > > On Fri, May 2, 2008 at 3:58 PM, Jose Fajardo < [mailto: > [EMAIL PROTECTED]@liquidlounge.com.au > >wrote: > > What your asking for is a perfect candidate for dependency properties :) > > > > When you create properties on a class you have the choice to make them > ordinary > > properties or a dependency property (introduced in Silverlight 2.0 and > previously > > existing in WPF). > > > > The reason you would want to make a property into a dependency property is > so that > > it can be databound to (as your probably aware of) > > > > In the case of wanting to listen to a property if it changes you would > want to > > implement the INotifyPropertyChanged class... > > > > The following like is a good post to explain databinding , it talks about > binding > > ways, value converters, property changed notifications etc.. > > > Read it and let me know if your still confused > > > > [ [ > http://www.u2u.info/Blogs/Peter/Lists/Posts/Post.aspx?ID=271%5Dhttp://www.u2u.info/Blogs/Peter/Lists/Posts/Post.aspx?ID=271 > ] > > http://www.u2u.info/Blogs/Peter/Lists/Posts/Post.aspx?ID=271]http://www.u2u.info/Blogs/Peter/Lists/Posts/Post.aspx?ID=271<http://www.u2u.info/Blogs/Peter/Lists/Posts/Post.aspx?ID=271%5Dhttp://www.u2u.info/Blogs/Peter/Lists/Posts/Post.aspx?ID=271> > > > > > > > > > > =============================================== > > > > Hmm.. > > > Nope, dont' have any depdenceny properties in my project... > > > Btw: Have another data binding question: > > > I wan't to trigger an animation when a property on the databound object > changes. > > Since we dont have triggers I have to do this in code, but I can't find a > way to > > "hook" the event to the DataContext object... > > > > So, when ever a property on my data context object changes I wan't to run > code to > > check if I need to run any animations... > > > Any suggestions? > > > Can't find a "ondatabinding" or "ondatacontextchanged" event to hook it > up... > > > > > > > On Fri, May 2, 2008 at 12:20 PM, Jose Fajardo <[mailto: [mailto: > [EMAIL PROTECTED] > [EMAIL PROTECTED] ] [mailto:[EMAIL PROTECTED] > [EMAIL PROTECTED] > > >wrote: > > > It sounds suspiciously related to dependency objects.. Does your > usercontrols implement > > > it's bindable properties as dependency properties? > > > > > > > ===================================================== > > > > > I'm doing some Silverlight databinding, and get a strange message in the > Output > > > window when running in debug mode: > > > > > BINDING: Can't convert type myFosters.SilverlightOrder to type > System.Windows.DOWrapper > > > > BINDING: Can't convert type myFosters.SilverlightOrder to type > System.Windows.DOWrapper > > > BINDING: Can't convert type myFosters.SilverlightOrder to type > System.Windows.DOWrapper > > > BINDING: Can't convert type myFosters.SilverlightOrder to type > System.Windows.DOWrapper > > > > > > > > > > > > > So basically I create a custom control for each SilverlightOrder and bind > it... > > > > I tried googeling for System.Windows.DOWrapper - No hits... > > > > > Any ideas? > > > > The app runs fine, and I can bind to properties on the SilverlightOrder > object inside > > > the OrderStatusLine control, but I still want to figure out what that > message means. > > > > cheers, > > > Jonas > > > > ------------------------------------------------------------------- > OzSilverlight.com > > > - to unsubscribe from this list, send a message back to the list with > 'unsubscribe' > > > as the subject. > > > Powered by [ [http://mailenable.com] http://mailenable.com ] [ > http://mailenable.com] > mailenable.com - List managed by [ [http://www.readify.net] > http://www.readify.net > ] [http://www.readify.net] www.readify.net > > > > > > ------------------------------------------------------------------- > OzSilverlight.com > > - to unsubscribe from this list, send a message back to the list with > 'unsubscribe' > > as the subject. > > > > Powered by [ [http://mailenable.com] http://mailenable.com ] [ > http://mailenable.com] > mailenable.com - List managed by [ [http://www.readify.net] > http://www.readify.net > ] [http://www.readify.net] www.readify.net > > > > ------------------------------------------------------------------- > OzSilverlight.com > > - to unsubscribe from this list, send a message back to the list with > 'unsubscribe' > > as the subject. > > Powered by [http://mailenable.com]mailenable.com - List managed by [ > http://www.readify.net]www.readify.net > > > > > ------------------------------------------------------------------- > OzSilverlight.com > - to unsubscribe from this list, send a message back to the list with > 'unsubscribe' > as the subject. > > > Powered by [http://mailenable.com]mailenable.com - List managed by [ > http://www.readify.net]www.readify.net > > > > ------------------------------------------------------------------- > OzSilverlight.com > - to unsubscribe from this list, send a message back to the list with > 'unsubscribe' > as the subject. > Powered by mailenable.com - List managed by www.readify.net > > > > ------------------------------------------------------------------- > OzSilverlight.com - to unsubscribe from this list, send a message back to > the list with 'unsubscribe' as the subject. > > Powered by mailenable.com - List managed by www.readify.net > > ------------------------------------------------------------------- OzSilverlight.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com - List managed by www.readify.net