![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| Thread Tools | |
| |