So the problem is that when the new list of Ordes is created that the
animation is not fired...
becuase when  i run the sample and hit the button the sample seems to work
fine...

correct

the reason that the animation is not firing when the list is created is
becuase
the "PropertyChanged" value for the "AllGood" property is equal to "null"
once it has been set once it is then equal to "Not null"

in your code you test for is equal to "not null"

thus it never fires on the initial creation of the order in the OrdersList,
so that Void/Method runs, but it fails the test...

*public virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}*


Anyway I think that is your issue?

GoodLuck :)

On 5/2/08, Jonas Follesø <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I created a simple repro of my problem. It consists of Order.cs (the
> object we wan't to bind against), Page.xaml, the main page containing a
> ListBox with a Custom OrderControl as the DataTemplate to display the Order
> object. The OrderControl contains a "light" that should animate between
> red/green depending on a property on the Order object.
>
> Hope this sample clarifies my problem and what I try to achieve.
>
> Cheers,
> Jonas :)
>
>
> But
>
> On Fri, May 2, 2008 at 6:17 PM, Jonas Follesø <[EMAIL PROTECTED]> wrote:
>
> > 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
>
>


-- 
.net noobie™

I have made a blog, but remember I am just a noobie
http://dotnetnoobie.spaces.live.com/

Now on the Gold Coast, need a worker, please contact me, thank you.



------------------------------------------------------------------- 
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

Reply via email to