Page view counter
Problem with error code 2207
Last post 10-25-2007 9:58 AM by Gondor. 1 replies.
Sort Posts:
10-25-2007 4:28 AM
Problem with error code 2207

Hi I get the following error when I execute the following code.

Silverlight error message

Error code=2207

Errortype runtimw error

Message AB_E_RUNTIME_METHOD

Method Name: Begin

The code is as follows:

Page.XAML

<Canvas

xmlns="http://schemas.microsoft.com/client/2007"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Canvas.Resources>

<Storyboard x:Name="mouseEnter">

<ColorAnimation Duration="00:00:00.25" To="#3DFFFFFF" Storyboard.TargetName="highlightButton" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" />

</Storyboard>

<Storyboard x:Name="mouseDown">

<ColorAnimation Duration="00:00:00.2" To="#22000000" Storyboard.TargetName="highlightButton" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" />

</Storyboard>

<Storyboard x:Name="mouseUp">

<ColorAnimation Duration="00:00:00.2" To="#3DFFFFFF" Storyboard.TargetName="highlightButton" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" />

</Storyboard>

<Storyboard x:Name="mouseLeave">

<ColorAnimation Duration="00:00:00.25" To="#00FFFFFF" Storyboard.TargetName="highlightButton" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" />

</Storyboard>

</Canvas.Resources>

 

<
Canvas Width="120" Height="44">

 

<
Rectangle Width="104" Height="40" Stroke="Black" StrokeThickness="2" Canvas.Left="43" Canvas.Top="64" RadiusX="10" RadiusY="10">

<Rectangle.Fill>

<LinearGradientBrush>

<GradientStop Color="Green" Offset="0"/>

<GradientStop Color="Black" Offset="0.7"/>

<GradientStop Color="Green" Offset="1"/>

</LinearGradientBrush>

</Rectangle.Fill>

</Rectangle>

<TextBlock Width="100" Height="100" Canvas.Left="63" Canvas.Top="73" TextWrapping="Wrap">

<TextBlock.Foreground>

<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">

<GradientStop Color="#FF635CD6" Offset="0"/>

<GradientStop Color="#FF00FF11" Offset="1"/>

</LinearGradientBrush>

</TextBlock.Foreground>

<Run Text="Click Me"/>

</TextBlock>

</Canvas>

</Canvas>

 Page.XAML.js

if (!window.SilverEventsDemo)

window.SilverEventsDemo = {};

SilverEventsDemo.Page =
function()

{

}

SilverEventsDemo.Page.prototype =

{

handleLoad:
function(control, userContext, rootElement)

{

this.control = control;

 

this.button=rootElement.children.getItem(0);

 

this.button.addEventListener("MouseEnter", Silverlight.createDelegate(this, this.handleMouseEnter));

this.button.addEventListener("MouseLeftButtonDown", Silverlight.createDelegate(this, this.handleMouseDown));

this.button.addEventListener("MouseLeftButtonUp", Silverlight.createDelegate(this, this.handleMouseUp));this.button.addEventListener("MouseLeave", Silverlight.createDelegate(this, this.handleMouseLeave));

},

 

// Sample event handler

 

handleMouseEnter :
function(sender, eventArgs)

{

//The following code shows how to find an element by name and calla method on it.

var mouseEnterAnimation=sender.findName("mouseEnter");

mouseEnterAnimation.begin();

},

 

handleMouseDown:
function(sender, eventArgs)

{

var mouseDownAnimation = sender.findName("mouseDown");

mouseDownAnimation.begin();

},

 

handleMouseUp:
function(sender, eventArgs)

{

var mouseUpAnimation = sender.findName("mouseUp");

mouseUpAnimation.begin();

alert(
"clicked");

},

 

handleMouseLeave:
function(sender, eventArgs)

{

var mouseLeaveAnimation = sender.findName("mouseLeave");

mouseLeaveAnimation.begin();

}

}

Please help. Im in urgent need of this kind of requirement.

Thanks in advance

Sreekanth Reddy. L

SreekanthReddy

Loading...
Joined on 05-17-2007
Hyderabad (India)
Posts 3
10-25-2007 9:58 AM
Marked as Answer
Re: Problem with error code 2207

The animations are targetting an object which doesn't exist in the xaml (TargetName="highlightButton").  This looks like it is based off the sample template ... perhaps you removed a little too much xaml?

Gondor

Loading...
Joined on 07-12-2007
Posts 31
Microsoft Communities