I have 2 wpf windows .
1. in which i draw a canvas , create storyboard and play that storybooard
2. this is basically a controller via which i want to control the pause and play functions of the story board .
The problem is that in order to acess the storyboard from the 2nd class i have to create an object of the first class in which the storyboard is declared which is not possible because , i am calling several methods from the constructor of that class
i am goiving the code below
class 1
public partial class Template1 : Window
{
// lots of variables
Storyboard animationStoryboard = new Storyboard();
public Template1()
{
InitializeComponent();
}
public Template1(MainWindow main)
{
InitializeComponent();
Method1();
method2();
//......
}
// various other methods for adding animations to the story boardclass 2
public partial class Window2 : Window
{
public Window2()
{
InitializeComponent();
}
private void Image_MouseDown_1(object sender, MouseButtonEventArgs e)
{
Template1 t1 = new Template1();
t1.animationstoryboard.pause();
}
}i have tried several ways to over the problem
1. i have declared storyboard object to be static
2. i have provided a blank contructor and created the object of the template 1 class ..
However the following error is always showed
"
system.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Pause'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='22264221'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='VisualStudioLikePanes.Template1'; TargetElement.HashCode='40417852'; TargetElement.Type='VisualStudioLikePanes.Template1"
How do i controll the storyboard from another wpf form ?
arka Bhattacharya