Page 8 of 10

Re: noesisGUI v1.2 BETA 7

Posted: 30 Jan 2015, 14:34
by Keyboarder
I've noticed that this perticular Storyboard property behaves static, that is, it changes on every object instance of the same class, independently of where it's played. However all other properties appear normal and affect only targeted instance.

Storyboard property:
 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="TitleLabel">
                <EasingColorKeyFrame KeyTime="0:0:0.1" Value="White"/>
 </ColorAnimationUsingKeyFrames>

Element:
 <Label x:Name="TitleLabel" Content="Label" VerticalAlignment="Center" Margin="15,0" FontSize="40" IsEnabled="False"/>
These are used in background/foreground color switching context, so the current workaround is to have 2 labels layered with different colors and then just lerp between them. Hope it helps.

Re: noesisGUI v1.2 BETA 8

Posted: 02 Feb 2015, 19:57
by jsantos
Let us check this tomorrow. We have been very busy with the release of new b8 (that you should also update to).

Thanks for your feedback!

Re: noesisGUI v1.2 BETA 7

Posted: 03 Feb 2015, 19:33
by sfernandez
I've noticed that this perticular Storyboard property behaves static, that is, it changes on every object instance of the same class, independently of where it's played. However all other properties appear normal and affect only targeted instance.

Storyboard property:
 <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="TitleLabel">
                <EasingColorKeyFrame KeyTime="0:0:0.1" Value="White"/>
 </ColorAnimationUsingKeyFrames>
Element:
 <Label x:Name="TitleLabel" Content="Label" VerticalAlignment="Center" Margin="15,0" FontSize="40" IsEnabled="False"/>
These are used in background/foreground color switching context, so the current workaround is to have 2 labels layered with different colors and then just lerp between them. Hope it helps.
I've tried a simple scene like this using our default style:
<Grid
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid.Resources>
        <Storyboard x:Key="anim" AutoReverse="True" RepeatBehavior="Forever">
            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)" Storyboard.TargetName="lbl">
                <EasingColorKeyFrame KeyTime="0:0:1" Value="Red"/>
            </ColorAnimationUsingKeyFrames>
        </Storyboard>
    </Grid.Resources>
    <Grid.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <EventTrigger.Actions>
                <BeginStoryboard Storyboard="{StaticResource anim}"/>
            </EventTrigger.Actions>
        </EventTrigger>
    </Grid.Triggers>
    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Background="Pink">
        <Label x:Name="lbl" Content="first label"/>
        <Label Content="second label"/>
    </StackPanel>
</Grid>
And it works as expected, only the first label is animated.

What kind of template are you using in your Label control?

Re: noesisGUI v1.2 BETA 8

Posted: 11 Feb 2015, 12:01
by elecman
Is it possible to make text created in InkScape work out of the box?

There are two problems:
-The FontFamily property exported by inkscape does not include a hash (#) character, causing a parsing error. Is it really necessary to have this in there?

-Inkscape does not put the actual text in the Text property, but uses span instead, which looks like this:
<Span whiteSpaceCollapse="preserve" FontSize="60">Some text here</Span>
Any chance in supporting this?

I am trying to reduce the manual work required on an XAML exported by InkScape and this will help a lot.

Re: noesisGUI v1.2 BETA 8

Posted: 11 Feb 2015, 18:33
by sfernandez
-The FontFamily property exported by inkscape does not include a hash (#) character, causing a parsing error. Is it really necessary to have this in there?
When FontFamily doesn't include a hash, it refers to OS installed fonts. In NoesisGUI we don't use support that. We can interpret FontFamily="Arial" the same as FontFamily="#Arial", but remember that you have to copy the corresponding .ttf fonts next to the xaml file so it can be found.
-Inkscape does not put the actual text in the Text property, but uses span instead, which looks like this:
<Span whiteSpaceCollapse="preserve" FontSize="60">Some text here</Span>
Any chance in supporting this?
Full support for inlines is planeed after 1.2 release. If you need it now we can transfer Span text into the outer TextBlock easily. But the properties set in the Span (like FontSize) will be lost, unless we override TextBlock properties with the properties of the first Span found inside the TextBlock.

Do you think this will work for you?

Re: noesisGUI v1.2 BETA 8

Posted: 12 Feb 2015, 01:04
by elecman
We can interpret FontFamily="Arial" the same as FontFamily="#Arial", but remember that you have to copy the corresponding .ttf fonts next to the xaml file so it can be found.
It would be great if you can add this fallback. Placing the fonts in the same folder is no problem for me and is a nice compromise to get out of the box functionality.
Full support for inlines is planned after 1.2 release. If you need it now we can transfer Span text into the outer TextBlock easily. But the properties set in the Span (like FontSize) will be lost, unless we override TextBlock properties with the properties of the first Span found inside the TextBlock.
Do you think this will work for you?
Yes, that will be great! My text is not fancy anyway and it will surely help to get my project up and running quickly. It will speed up my workflow a lot because it looks like:
Edit file in InkScape -> Export to xaml -> Test in Unity -> Edit file in InkScape -> Export to xaml -> Test in Unity, etc. If I have to open up the exported file and move the text out of the span all the time is a lot of work. I will deal with the FontSize issue later.

Re: noesisGUI v1.2 BETA 8

Posted: 13 Feb 2015, 14:30
by elecman
I noticed that if the rotation center is at the center of the bounding box (default, 0.5,0.5) it is not even added to the xaml file when using Blend, so presumably this is part of the spec. However, if you want to rotate an object from code using NoesisGUI, you have to force the rotation center to be 0.5,0.5 because it defaults to zero. Shouldn't it default to the center instead?

Re: noesisGUI v1.2 BETA 8

Posted: 14 Feb 2015, 21:19
by sfernandez
As stated in WPF documentation, the default value of RenderTransformOrigin property is (0,0), and we followed that description.

In Blend, if you start to transform an element, it automatically adds RenderTransformOrigin="0.5,0.5" to the element because the default value is (0,0). It also adds the typical group of transforms:
<TransformGroup>
  <ScaleTransform/>
  <SkewTransform/>
  <RotateTransform/>
  <TranslateTransform/>
</TransformGroup>

Re: noesisGUI v1.2 BETA 8

Posted: 14 Feb 2015, 23:02
by elecman
Ah, I see. No problem :-)

Re: noesisGUI v1.2 BETA 8

Posted: 15 Feb 2015, 00:04
by jsantos
Yes, that will be great! My text is not fancy anyway and it will surely help to get my project up and running quickly.
Please file a bug for this.Thanks!