Sunday, 15 August 2010

WPF form opacity -



WPF form opacity -

i have problem playing opacity animation in wpf. have button shows form double animation of opacity 0 1. when press see sec form opacity = 1 several milliseconds , after opacity starts changing 0 1. how can skip appearance of sec form opacity = 1 before animation starts?

this main form:

public partial class mainwindow : window { window1 _wind; public mainwindow() { initializecomponent(); _wind = new window1(); } private void button1_click(object sender, routedeventargs e) { _wind.showform(); } }

and sec form animation:

public window1() { initializecomponent(); this.opacity = 0; this.image1.opacity = 0; } public void showform() { this.opacity = 0; this.image1.opacity = 0; doubleanimation dblanim = new doubleanimation(); dblanim.from = 0.0; dblanim.to = 1.0; dblanim.duration = new duration(timespan.frommilliseconds(1500)); scaletransform trans = new scaletransform(); this.image1.rendertransform = trans; this.image1.beginanimation(image.opacityproperty, dblanim); this.rendertransform = trans; this.beginanimation(image.opacityproperty, dblanim); this.showdialog(); } private void button1_click(object sender, routedeventargs e) { this.opacity = 0; this.image1.opacity = 0; this.visibility = visibility.hidden; }

wpf opacity

No comments:

Post a Comment