Just FYI,

 

DOWrapper is in System.Windows.dll.

 

internal class DOWrapper
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DOWrapper>  : DependencyObject
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DependencyObject> 

{

    // Fields

    internal object
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.
5.0:7cec85d7bea7798e/System.Object>  Target
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DOWrapper/Target:Object> ;

 

    // Methods

    internal DOWrapper
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DOWrapper/.ctor()> () : base
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DependencyObject/.ctor(UInt32)>
(1)

    {

    }

 

    internal DOWrapper
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DOWrapper/.ctor(Object)> (object
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://mscorlib:2.0.
5.0:7cec85d7bea7798e/System.Object>  o) : base
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DependencyObject/.ctor(UInt32)>
(1)

    {

        this.Target
<http://www.aisto.com/roeder/dotnet/Default.aspx?Target=code://System.Window
s:2.0.5.0:7cec85d7bea7798e/System.Windows.DOWrapper/Target:Object>  = o;

    }

}

 

And Reflector's analyser says:

 

System.Windows.DOWrapper

                Used By

 
System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(Depende
ncyObject, Object) : Void

 
System.Windows.Data.BindingExpression.UpdateValue() : Void

                                System.Windows.FrameworkElement..cctor()

 
System.Windows.FrameworkElement.get_DataContext() : Object

 
System.Windows.FrameworkElement.set_DataContext(Object) : Void

                Exposed By

                Instantiated By

 
System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(Depende
ncyObject, Object) : Void

 
System.Windows.FrameworkElement.set_DataContext(Object) : Void

 

Jonathan.

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jonas Follesø
Sent: Saturday, 3 May 2008 12:37 AM
To: listserver@ozsilverlight.com
Subject: Re: [OzSilverlight] Strange databinding problem

 

.net noobie: Thanks for the tip, but that's not the problem. I hook up the
event in the DependencyPropertyChanged delegate.

Dimaz: You're right, that's the problem. The PropertyChangedCallback
executed before the control is loaded, and therefore I have to queue the
animation. I added a simple Queue<Storyboard> which I empty and play in the
control loaded events, and it now works...

But this solution still feels a little bit "Frankenstein". In order to
trigger animation based on a databound object I need to:

1) Create a dependency property (even tough the object is allready bound
using DataContext)
2) Hook the PropertyChangedCallback of the dependency property to add the
PropertyChanged event listener
3) Queue any initial state animations in the PropertyChangedCallback
4) Subscribe to the Control_Loaded event and empty the queue and play any
queued animation...

I've attached an updated version which now works, but still isn't to
elegant.




On Fri, May 2, 2008 at 11:07 PM, Dimaz Pramudya <[EMAIL PROTECTED]>
wrote:

Also, another thing to note is the animation will only start after the user
control / canvas is LOADED.
This means, any request to start the animation before hand (eg: in
constructor, etc) will be ignored.

Therefore, it is best to implement your own "Animation" Queueing engine and
invoke the animation within the OnLoaded Event Handler.
Hope this helps.

Dimaz Pramudya

 

On Fri, May 2, 2008 at 10:54 PM, .net noobie <[EMAIL PROTECTED]> wrote:

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.u
2u.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.u
2u.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 


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

Reply via email to