Page 1 of 1

(Unity3d) NoesisException: Unknown member BitmapImage.UriSource

Posted: 20 Jun 2017, 21:39
by EvanWeeks
NoesisGUI is choking on the XAML below. It works if I host the control in a WPF window, but Unity doesn't seem to like it. What am I doing that Noesis and Unity don't like?
<Button VerticalAlignment="Center" HorizontalAlignment="Center" Background="#00DDDDDD" BorderBrush="#00707070">
    <Image Source="../Images/NewGame.png" Width="200">
        <Image.Triggers>
            <EventTrigger RoutedEvent="Button.MouseEnter">
                <BeginStoryboard>
                    <Storyboard x:Name="NewGameAnimation" Duration="0:0:2">
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Source">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                <DiscreteObjectKeyFrame.Value>
                                    <BitmapImage UriSource="../Images/NewGame.png" />
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:2">
                                <DiscreteObjectKeyFrame.Value>
                                    <BitmapImage UriSource="../Images/NewGameGlow.png" />
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
            <EventTrigger RoutedEvent="Button.MouseLeave">
                <BeginStoryboard>
                    <Storyboard Duration="0:0:2">
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Source">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                <DiscreteObjectKeyFrame.Value>
                                    <BitmapImage UriSource="../Images/NewGameGlow.png" />
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                            <DiscreteObjectKeyFrame KeyTime="0:0:2">
                                <DiscreteObjectKeyFrame.Value>
                                    <BitmapImage UriSource="../Images/NewGame.png" />
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Image.Triggers>
    </Image>
</Button>

Re: (Unity3d) NoesisException: Unknown member BitmapImage.UriSource

Posted: 21 Jun 2017, 13:48
by sfernandez
Hi,

It seems UriSource property is not exposed to be used from Xaml, please create a ticket in our bugtracker and we will add it in a future release.

Meanwhile you can use a StaticResource as a workaround, besides it will be more efficient:
<Grid
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <ImageSource x:Key="NewGameImg">../Images/NewGame.png</ImageSource>
        <ImageSource x:Key="NewGameGlowImg">../Images/NewGameGlow.png</ImageSource>
    </Grid.Resources>
    <Button VerticalAlignment="Center" HorizontalAlignment="Center" Background="#00DDDDDD" BorderBrush="#00707070">
        <Image Source="{StaticResource NewGameImg}" Width="200">
            <Image.Triggers>
                <EventTrigger RoutedEvent="Button.MouseEnter">
                    <BeginStoryboard>
                        <Storyboard x:Name="NewGameAnimation" Duration="0:0:2">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Source">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource NewGameImg}"/>
                                <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="{StaticResource NewGameGlowImg}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
                <EventTrigger RoutedEvent="Button.MouseLeave">
                    <BeginStoryboard>
                        <Storyboard Duration="0:0:2">
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Source">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource NewGameGlowImg}"/>
                                <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="{StaticResource NewGameImg}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Image.Triggers>
        </Image>
    </Button>
</Grid>

Re: (Unity3d) NoesisException: Unknown member BitmapImage.UriSource

Posted: 21 Jun 2017, 13:52
by EvanWeeks
Gotcha. Will post the bug when I get out of this meeting and back to my desk. Thanks for the help!

Re: (Unity3d) NoesisException: Unknown member BitmapImage.UriSource

Posted: 22 Jun 2017, 20:31
by jsantos
Thanks to you for the feedback! This will be solved in the next version.