Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - ML

 
 
Old 05-15-2006   #1 (permalink)
bbouilliez.schneider@gmail.com


 
 

ML

Hi there!

I've got a project working well in which I'm using Templates for my
buttons.
As I'd like to re-use these templates in another project, I copy/paste
my xaml code in the other project.

And when I want to edit these templates in my second project, I've got
a crash, and the debugging tool gives me hte message :"Cannot get
NodePath for ViewNode which is not a part of the view tree"...
I don't really understand what's going on as this template works
perfectly and can be edited in my first project.

Here's the xaml code:
////////////////////////////////////////// The XAML Code
<ControlTemplate x:Key="TemplateBtnHome" TargetType="{x:Type
ButtonBase}">
<ControlTemplate.Resources>
<Storyboard x:Key="MouseOverHome" d:StoryboardName="MouseOverHome">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="Rectangle">
<SplineColorKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5"
KeySpline="0.5,0.5,0.5,0.5" Value="sc#1, 1, 1, 1"
KeyTime="00:00:00.3330000"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>

<Storyboard x:Key="MouseLeaveHome"
d:StoryboardName="MouseLeaveHome">
<ColorAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
Storyboard.TargetName="Rectangle">
<SplineColorKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5"
KeySpline="0.5,0.5,0.5,0.5" Value="sc#1, 0.125, 0.125, 0.125"
KeyTime="00:00:00.3330000"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>

</ControlTemplate.Resources>

<Grid x:Name="Grid" RenderTransformOrigin="0.5,0.5">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Path d:LayoutOverrides="Height" Fill="{Binding Fill,
ElementName=Rectangle, Mode=OneWay}" HorizontalAlignment="Center"
VerticalAlignment="Center" Margin="0,0,0,0" Width="24"
Height="19.921875" x:Name="Path" Data="F1 M 24.000000,9.134766 L
19.833984,9.134766 L 19.833984,19.921875 L 14.139648,19.921875 L
14.139648,13.127930 L 10.405273,13.127930 L 10.405273,19.921875 L
4.194336,19.921875 L 4.194336,9.134766 L 0.000000,9.134766 L
12.013672,0.000000 L 24.000000,9.134766 L 24.000000,9.134766 Z"/>
<Rectangle Opacity="0" Fill="sc#1, 0.125, 0.125, 0.125"
x:Name="Rectangle" RenderTransformOrigin="0.5,0.5"/>
</Grid>

<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="Mouse.MouseEnter"
SourceName="Rectangle">
<BeginStoryboard Storyboard="{StaticResource MouseOverHome}"
x:Name="MouseOverHome_BeginStoryboard"/>
</EventTrigger>
<EventTrigger RoutedEvent="Mouse.MouseLeave"
SourceName="Rectangle">
<BeginStoryboard Storyboard="{StaticResource MouseLeaveHome}"
x:Name="MouseLeaveHome_BeginStoryboard"/>
</EventTrigger>
</ControlTemplate.Triggers>

</ControlTemplate>
///////////////////////////////////////////////////////////////////////////////////////////

If sby has a clue....

thanks!

--
Benjamin


My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46