![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Animating parts of a custom FrameworkElement (OnRender and DoubleAnimation question) My diagramming application uses custom controls and is somewhat similar (in appearance, at least) to the class-designer in VS2005. The overriden OnRender works well but now I want to animate the collapse/expand behavior of the 'class shape'. I was able to implement it in XAML but porting it to code is somewhat difficult. In particular, the public expand method: public void Expand() { expanded = true; this.InvalidateVisual(); DoubleAnimation anim = new DoubleAnimation(0.0, 1.0, new Duration(new TimeSpan(0, 0, 4))); xrg.BeginAnimation(FrameworkElement.OpacityProperty, anim); //xrg is a sub-element of the control } does not produce a visual effect. Obviously the OnRender is not called when the sub-element is animated. How should I do this? In general, how to animate part of a custom control? [Thx] |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Animating parts of a custom FrameworkElement (OnRender and DoubleA From what I know if you use visual layer programming you will sacrifice some benefits of the high level stuff - like animations, databinding etc.. Just out of curiosity, why did you go with visuals? -- Valentin Iliescu [MVP - Client Application Development] "Illumineo" wrote: > My diagramming application uses custom controls and is somewhat similar > (in appearance, at least) to the class-designer in VS2005. The > overriden OnRender works well but now I want to animate the > collapse/expand behavior of the 'class shape'. I was able to implement > it in XAML but porting it to code is somewhat difficult. In particular, > the public expand method: > > public void Expand() > { > expanded = true; > this.InvalidateVisual(); > DoubleAnimation anim = new DoubleAnimation(0.0, 1.0, new > Duration(new TimeSpan(0, 0, 4))); > xrg.BeginAnimation(FrameworkElement.OpacityProperty, anim); > //xrg is a sub-element of the control > } > > does not produce a visual effect. Obviously the OnRender is not called > when the sub-element is animated. How should I do this? In general, how > to animate part of a custom control? > > [Thx] > > |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Animating parts of a custom FrameworkElement (OnRender and DoubleA It seems I should use the CompositionTarget class, as the documentation says, to '...create custom drawings or animations based on a per-frame callback..' I was able to achieve what I wanted to do by replacing the custom control by a UserControl which allowed me to have the animation in XAML rather than in code. In any case, what I have learned is this: you cannot trust the rendering engine to do something for you. The intrinsic refresh-algorithm is untouchable even if you call InvalidateVisual or InvalidateArrange. Maybe I'm so used to the painting loop in Win32 or Net2. The drawback of this is that it's very difficult to know what you have to do to optimize the code in function of 'big' diagrams or graph/diagrammatic processes. |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question from .net beginner regarding rebuilding custom class library | jz3 | .NET General | 3 | 03-13-2008 02:36 PM |
| Custom Picture Question | Mike McCollister | Vista account administration | 0 | 06-11-2007 07:40 PM |
| API Standards question: FrameworkElement.Focusable | Keith Patrick | Avalon | 3 | 02-27-2006 02:11 AM |
| DoubleAnimation.Completed and DoubleAnimation.CurrentStateInvalidated | Lei Jiang | Avalon | 0 | 02-26-2006 06:05 AM |
| How to get the coordinates of a FrameworkElement? | Jason Dolinger | Avalon | 2 | 01-31-2006 07:00 AM |