User avatar
EvanWeeks
Topic Author
Posts: 8
Joined: 05 Jun 2017, 20:05

(Unity3d) NoesisException: Unknown member BitmapImage.UriSource

20 Jun 2017, 21:39

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>
 
User avatar
sfernandez
Site Admin
Posts: 3154
Joined: 22 Dec 2011, 19:20

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

21 Jun 2017, 13:48

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>
 
User avatar
EvanWeeks
Topic Author
Posts: 8
Joined: 05 Jun 2017, 20:05

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

21 Jun 2017, 13:52

Gotcha. Will post the bug when I get out of this meeting and back to my desk. Thanks for the help!
 
User avatar
jsantos
Site Admin
Posts: 4124
Joined: 20 Jan 2012, 17:18
Contact:

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

22 Jun 2017, 20:31

Thanks to you for the feedback! This will be solved in the next version.

Who is online

Users browsing this forum: No registered users and 1 guest