Simple issue

Aug 19, 2008 at 10:18 AM
Hi
i'm trying this simple code but the transition is never triggered

<

Window x:Class="NoteSearch.TransitionWindow"

 

 

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

 

 

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

 

 

xmlns:tranc="clr-namespace:Transitionals.Controls"

 

 

xmlns:trant="clr-namespace:Transitionals.Transitions"

 

 

Title="TransitionWindow" Height="300" Width="300">

 

 

<Window.Resources>

 

 

<Image x:Name="img1" x:Key="img11" Source="Resources\Splash.png"></Image>

 

 

<Image x:Name="img2" x:Key="img22" Source="Resources\Splash.png"></Image>

 

 

 

</Window.Resources>

 

 

<Canvas>

 

 

<tranc:TransitionElement x:Name="TransitionBox">

 

 

<tranc:TransitionElement.Transition>

 

 

<trant:PageTransition />

 

 

</tranc:TransitionElement.Transition>

 

 

</tranc:TransitionElement>

 

 

<Button Click="Button_Click" Height="21" Canvas.Left="34" Canvas.Top="214" Width="56">Transition</Button>

 

 

<Button Click="Button2_Click" Height="21" Canvas.Left="34" Canvas.Top="280" Width="56">Transition2</Button>

 

 

</Canvas>

 

</

Window>

 

Coordinator
Aug 21, 2008 at 2:08 PM
You didn't include the contents of the Button_Click or Button2_Click handlers.

Also, if you could remove some of the whitespace from your sample it would be greatly appreciated.
Aug 21, 2008 at 4:07 PM

 This is the code, however i dont know how to remove the space since it is anhtml paragraph


public
partial class TransitionWindow : Window

 

{

 

 

public TransitionWindow()

 

 {InitializeComponent();}

 

private void Button_Click(object sender, RoutedEventArgs e)

 

{

TransitionBox.Content = (Image)FindResource("img11"); }

 

 

private void Button2_Click(object sender, RoutedEventArgs e)

 

 {TransitionBox.Content = (

Image)FindResource("img22"); }

 

}

Thanks
Jonathan

Coordinator
Sep 30, 2008 at 8:03 PM
Hey Jon,

Sorry it took me so long to reply, I don't know how I missed the notification.

I can only see to potential causes as to why the transition isn't firing. One, you should verify that in both button click handlers you're actually getting an image from FindResource rather than null. This can happen if your resource path names are incorrect in the xaml.

If you're actually getting the images, the next problem I see is that both resource names point at the same resource file ("Splash.png"). You might not notice the transition since the content isn't really changing. In fact, if FindResource("img11") and FindResource("img22") return the exact same object reference the transition won't fire. Transitionals will ignore a request to transition to the same piece of content.

Hope that helps,

Jared