Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9058859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:49:38+00:00 2026-06-16T14:49:38+00:00

in my UserControl I have three ComboBoxes which all have to be selected before

  • 0

in my UserControl I have three ComboBoxes which all have to be selected before the save button is enabled. I defined a MultiDataTrigger with Bindings to my ViewModel Properties which are set to null initially. So when the control is loaded the button is disabled as expected but as soon as one of the ComboBoxes is selected the button will be enabled. As I understood all conditions of a MultiDataTrigger have to be met in order for it to fire?

Here’s my Button Style:

        <Style x:Key="saveButton" TargetType="{x:Type Button}">
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=CurrentSpeech.Room, Converter={StaticResource nullToBoolConverter}}" Value="true" />
                    <Condition Binding="{Binding Path=CurrentSpeech.Speaker, Converter={StaticResource nullToBoolConverter}}" Value="true" />
                    <Condition Binding="{Binding Path=CurrentSpeech.Track, Converter={StaticResource nullToBoolConverter}}" Value="true" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Button.IsEnabled" Value="False" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>

My ComboBoxes:

            <ComboBox Margin="3" Grid.Row="4" Grid.Column="1" ItemsSource="{Binding Path=Rooms, Mode=OneWay}"
                      SelectedItem="{Binding Path=CurrentSpeech.Room, Mode=TwoWay}" DisplayMemberPath="Name"/>
            <ComboBox Margin="3" Grid.Row="5" Grid.Column="1" ItemsSource="{Binding Path=Tracks, Mode=OneWay}"
                      SelectedItem="{Binding Path=CurrentSpeech.Track, Mode=TwoWay}" DisplayMemberPath="Title"/>
            <ComboBox Margin="3" Grid.Row="6" Grid.Column="1" ItemsSource="{Binding Path=Speakers, Mode=OneWay}" 
                      SelectedItem="{Binding Path=CurrentSpeech.Speaker, Mode=TwoWay}" DisplayMemberPath="Name"/>

My Button:

                <Button Style="{StaticResource saveButton}" Margin="3" Grid.Row="9" Grid.Column="1" Command="{Binding Path=CurrentSpeech.SaveCommand}" Width="150" HorizontalAlignment="Right" Content="Speichern"/>

And my Converter:

    [ValueConversion(typeof(object), typeof(bool))]
public class NullToBoolConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        bool result = value == null ? true : false;
        if (parameter != null)
            return !result;
        return result;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return value;
    }
}

Thanks,
Paxx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:49:39+00:00Added an answer on June 16, 2026 at 2:49 pm

    The trigger seems to work fine, it’s just your logic that is not correct.

    As it works now, the trigger will be activated when the Room, Speaker and Track properties are all null. That happens when the program starts, since nothing is selected in either of the ComboBoxes.

    So all 3 conditions are met, and the trigger disables the Button.

    When you then select something in the Rooms combobox, the first condition in the trigger is no longer met, since the ValueConverter now returns false for that binding, so the trigger is disabled and this causes the button to be enabled.

    So to fix this issue, you should disable the Button initially, and only set it enabled in the trigger, when the converters return false for all bindings (when the 3 properties are NOT null).

    <Style x:Key="saveButton" TargetType="{x:Type Button}">
        <Setter Property="IsEnabled" Value="False"/>
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding Path=Room, Converter={StaticResource nullToBoolConverter}}" Value="false" />
                    <Condition Binding="{Binding Path=Speaker, Converter={StaticResource nullToBoolConverter}}" Value="false" />
                    <Condition Binding="{Binding Path=Track, Converter={StaticResource nullToBoolConverter}}" Value="false" />
                </MultiDataTrigger.Conditions>
                <Setter Property="Button.IsEnabled" Value="True" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three usercontrols: usercontrolA , usercontrolB and usercontrolC which all share the same
I have a button inside my UserControl. I have three instances of this UserControl
I have usercontrol, and there is a DependencyProperty defined in it. #region ImageUri public
I have a UserControl which overrides the OnRender-Method as follow: MyUsercontrol.cs: MyUserControl: UserControl {
I have a UserControl and it contains a Button . Now, in some Windows
I have an UserControl that contains a Button : <UserControl> <Button> </UserControl> I want
I have a UserControl which contains a TextBox . When my main window loads
I have a UserControl which I have added to my web.config <add tagPrefix=BCF src=~/controls/MyMessageBox.ascx
I have a UserControl A which contains a dropdown a placeholder At runtime the
I have a UserControl with a Tab Control containing three tabs. Within the tabs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.