DataTriggers & UpdateSourceTrigger
Hi guys (and girls),
I'm a new user of NoesisGUI for Unity, to do UI development for a (non-game) application.
NoesisGUI gives great opportunities for designing XAML seperate from the application itself. However, I'm missing some (essential) features to be able to really seperate UI and engine/scripts.
First of all, DataTriggers. For example, to automatically draw a border around a listbox-item when that "cue" is "running" (that's seperate from the selected item). That's something that should really be possible from just the XAML with binding to a DataTrigger, instead of diving into code.
Second, UpdateSourceTrigger. I think in most cases, a textbox should "validate" (bind) not when typing a character, but when losing focus. That's easy via the UpdateSourceTrigger. Could we get that in NoesisGUI for Unity please?
However, thanks for creating & supporting such a great product. Keep it up!
I'm a new user of NoesisGUI for Unity, to do UI development for a (non-game) application.
NoesisGUI gives great opportunities for designing XAML seperate from the application itself. However, I'm missing some (essential) features to be able to really seperate UI and engine/scripts.
First of all, DataTriggers. For example, to automatically draw a border around a listbox-item when that "cue" is "running" (that's seperate from the selected item). That's something that should really be possible from just the XAML with binding to a DataTrigger, instead of diving into code.
Second, UpdateSourceTrigger. I think in most cases, a textbox should "validate" (bind) not when typing a character, but when losing focus. That's easy via the UpdateSourceTrigger. Could we get that in NoesisGUI for Unity please?
However, thanks for creating & supporting such a great product. Keep it up!
-
-
sfernandez
Site Admin
- Posts: 3203
- Joined:
Re: DataTriggers & UpdateSourceTrigger
Hi,
You are right, DataTriggers are very very useful and that's why we want to incorporate them in one of the following releases. Meanwhile the scenario you exposed should be done exposing Visibility properties in the DataContext to hide/show parts of the DataTemplate depending on the state of your data item.
You will be glad to hear that UpdateSourceTrigger is implemented, but it seems that default UpdateSourceTrigger is not correctly set in the TextBox.Text property, it should be set to LostFocus. We will fix it for the next release, thanks for pointing it out.
You are right, DataTriggers are very very useful and that's why we want to incorporate them in one of the following releases. Meanwhile the scenario you exposed should be done exposing Visibility properties in the DataContext to hide/show parts of the DataTemplate depending on the state of your data item.
You will be glad to hear that UpdateSourceTrigger is implemented, but it seems that default UpdateSourceTrigger is not correctly set in the TextBox.Text property, it should be set to LostFocus. We will fix it for the next release, thanks for pointing it out.
Re: DataTriggers & UpdateSourceTrigger
Thanks for the quick reply!
To use the visibility property binding to a bool, I need a boolToVisibility converter. As far as I can find, converters are not available in Noesis for Unity3D (yet)..
For the UpdateSourceTrigger ; great to hear it's coming. And having lostfocus as default for a textbox sounds logical to me. Thanks again!
Jeroen
To use the visibility property binding to a bool, I need a boolToVisibility converter. As far as I can find, converters are not available in Noesis for Unity3D (yet)..
For the UpdateSourceTrigger ; great to hear it's coming. And having lostfocus as default for a textbox sounds logical to me. Thanks again!
Jeroen
-
-
sfernandez
Site Admin
- Posts: 3203
- Joined:
Re: DataTriggers & UpdateSourceTrigger
What I mean about the visibility is to expose in the ViewModel a property of type Visibility synchronized with the bool:
Then bind the visibility of the Cue representation in the DataTemplate with that property:
---
And the other issue, you can already use the UpdateSourceTrigger.LostFocus, but as I mentioned it is not correctly initialized in the TextBox, so you need to specify it manually:
Code: Select all
public class ViewModel : Noesis.BaseComponent
{
private bool _isRunning = false;
public bool IsRunning
{
get { return _isRunning; }
set
{
_isRunning = value;
ShowCue = (value ? Noesis.Visibility.Visible : Noesis.Visibility.Hidden);
}
}
public Noesis.Visibility ShowCue { get; private set; }
// ...
}
Code: Select all
<DataTemplate>
<Grid>
<Rectangle Stroke="Red" Margin="-1" Visibility="{Binding ShowCue}"/>
<TextBlock Text="{Binding Name}"/>
</Grid>
</DataTemplate>
And the other issue, you can already use the UpdateSourceTrigger.LostFocus, but as I mentioned it is not correctly initialized in the TextBox, so you need to specify it manually:
Code: Select all
<TextBox Text="{Binding Login, UpdateSourceTrigger=LostFocus}"/>
-
- ai_enabled
- Posts: 231
- Joined:
- Contact:
Re: DataTriggers & UpdateSourceTrigger
I'm really missing DataTrigger feature in NoesisGUI, as I can't implement changing ContentTemplate without DataTrigger and need to use sophisticated workarounds. Hope you can bring it in the future release (I mean after 1.2)!
AtomicTorch Studio Pte. Ltd. http://atomictorch.com
Re: DataTriggers & UpdateSourceTrigger
Yes, DataTriggers are in the list of imminent features to be implemented after v1.2.0
Re: DataTriggers & UpdateSourceTrigger
Congratulations on 1.2! Can't wait to start using it!
Absolutely would love to see data triggers in a soon to be release! In the meantime, can you suggest a clean XAML only approach for doing messaging/prompts (a user rolls over a button or clicks and a message somewhere else on the screen appears to tell them what it is and what it does; not tool tips). Pretty straight forward and was thinking data triggers would be a nice solution, but...
Absolutely would love to see data triggers in a soon to be release! In the meantime, can you suggest a clean XAML only approach for doing messaging/prompts (a user rolls over a button or clicks and a message somewhere else on the screen appears to tell them what it is and what it does; not tool tips). Pretty straight forward and was thinking data triggers would be a nice solution, but...

-
-
sfernandez
Site Admin
- Posts: 3203
- Joined:
Re: DataTriggers & UpdateSourceTrigger
Thanks
I don't know if I understood correctly the scenario you want, but I have created this:

I don't know if I understood correctly the scenario you want, but I have created this:
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid.Resources>
<Storyboard x:Key="showHi">
<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetName="hiMsg" Storyboard.TargetProperty="RenderTransform.Y"/>
<DoubleAnimation Duration="0:0:0.3" To="1" Storyboard.TargetName="hiMsg" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
<Storyboard x:Key="hideHi">
<DoubleAnimation Duration="0:0:0.3" To="-100" Storyboard.TargetName="hiMsg" Storyboard.TargetProperty="RenderTransform.Y"/>
<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetName="hiMsg" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
<Storyboard x:Key="showBye">
<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetName="byeMsg" Storyboard.TargetProperty="RenderTransform.Y"/>
<DoubleAnimation Duration="0:0:0.3" To="1" Storyboard.TargetName="byeMsg" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
<Storyboard x:Key="hideBye">
<DoubleAnimation Duration="0:0:0.3" To="-100" Storyboard.TargetName="byeMsg" Storyboard.TargetProperty="RenderTransform.Y"/>
<DoubleAnimation Duration="0:0:0.3" To="0" Storyboard.TargetName="byeMsg" Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</Grid.Resources>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top">
<Border x:Name="hiMsg" BorderBrush="Black" BorderThickness="1" Background="Silver" Padding="50,20">
<Border.RenderTransform>
<TranslateTransform Y="-100"/>
</Border.RenderTransform>
<TextBlock Text="Hi" Foreground="Black" FontSize="20"/>
</Border>
<Border x:Name="byeMsg" BorderBrush="Black" BorderThickness="1" Background="Silver" Padding="50,20">
<Border.RenderTransform>
<TranslateTransform Y="-100"/>
</Border.RenderTransform>
<TextBlock Text="Bye" Foreground="Black" FontSize="20"/>
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="5">
<Button Content="Say Hi" Padding="20,0">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard Storyboard="{StaticResource hideBye}"/>
<BeginStoryboard Storyboard="{StaticResource showHi}"/>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
<Button Content="Say Bye" Padding="20,0">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard Storyboard="{StaticResource hideHi}"/>
<BeginStoryboard Storyboard="{StaticResource showBye}"/>
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
</Grid>
Who is online
Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 4 guests