Support for Triggers, DataTriggers?

klf
Posts: 1
Joined: Thu Apr 14, 2016 9:55 am

Support for Triggers, DataTriggers?

Postby klf » Thu Apr 14, 2016 10:03 am

Data triggers or triggers in general don't seem to be supported currently. In the roadmap I can't find them announced.
Is it planned?

When using a MVVM approach, data triggers are pretty essential to me. This is what makes code clean and standardized.
Simple example: show items in a combo box for selection. But if only 1 item exists then show a text block only (nothing to select).

Code: Select all

<UserControl x:Class="CrossPlattformTest.Wpf.ElementPicker"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
       
        <ComboBox Grid.Row="0" ItemsSource="{Binding Hierarchies}">
            <ComboBox.Style>
                <Style TargetType="ComboBox">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Hierarchies.Count}" Value="1">
                            <Setter Property="Visibility" Value="Collapsed" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ComboBox.Style>
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Title}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>
       
        <Border>
            <Border.Style>
                <Style TargetType="Border">
                    <Setter Property="Visibility" Value="Collapsed" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Hierarchies.Count}" Value="1">
                            <Setter Property="Visibility" Value="Visible" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
            <TextBlock Text="{Binding FirstHierarchy.Title}" />
        </Border>
    </Grid>
</UserControl>

JS-Support
Site Admin
Posts: 740
Joined: Tue Apr 08, 2014 3:42 pm

Re: Support for Triggers, DataTriggers?

Postby JS-Support » Mon Apr 25, 2016 2:12 pm

Hi,

Thanks for your message.

We have added Triggers and DataTriggers to the roadmap. You can read the updated roadmap here.

The ComboBox is not yet templatable (it uses the native HTML5 combo box, which is also particularly suited for mobile devices, on which it renders differently), but we are working on it.

We have also added a page about how to customize the appearance of controls using Styles and ControlTemplates. On that page you can see the progress that we are making to support this kind of things.

Thanks again.

Regards,
JS-Support


Return to “General Discussion and Other”

Who is online

Users browsing this forum: No registered users and 1 guest

 

 

cron