Hallo liebe Community,
ich habe folgenden Code:
Das Fenster soll über die Taskleiste rechts unten positioniert werden. Passiert auch.
Jedoch wird die Animation nur einmal ausgeführt. Bei erneutem Ausführen der Methode geschieht nichts mehr. (Ja ich habe das Fenster vorher wieder verschoben )
Habe ich vielleicht vergessen irgendeine Property zu ändern?
Liebe Grüße
Julian
EDIT: Und wäre es möglich hier auch noch eine Trägheit mit einzubauen?
ich habe folgenden Code:
C#-Quellcode
- private void AutoAlignPosition(bool animate = false)
- {
- Size r = SystemParameters.WorkArea.Size;
- double targetTop = r.Height - this.Height;
- double targetLeft = r.Width - this.Width;
- Debug.WriteLine(targetLeft);
- Debug.WriteLine(targetTop);
- if(!animate)
- {
- this.Top = targetTop;
- this.Left = targetLeft;
- }
- else
- {
- DoubleAnimation animatorTop = new DoubleAnimation(this.Top, targetTop, new Duration(TimeSpan.FromSeconds(0.2))) { AutoReverse = false };
- DoubleAnimation animatorLeft = new DoubleAnimation(this.Left, targetLeft, new Duration(TimeSpan.FromSeconds(0.2))) { AutoReverse = false };
- this.BeginAnimation(Window.LeftProperty, animatorLeft);
- this.BeginAnimation(Window.TopProperty, animatorTop);
- }
- }
Das Fenster soll über die Taskleiste rechts unten positioniert werden. Passiert auch.
Jedoch wird die Animation nur einmal ausgeführt. Bei erneutem Ausführen der Methode geschieht nichts mehr. (Ja ich habe das Fenster vorher wieder verschoben )
Habe ich vielleicht vergessen irgendeine Property zu ändern?
Liebe Grüße
Julian
EDIT: Und wäre es möglich hier auch noch eine Trägheit mit einzubauen?
Hmkay.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „jedijaeger“ ()