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 1085903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:44:49+00:00 2026-05-16T22:44:49+00:00

I have a DataTrigger setup like so: <UserControl.Resources> <Style x:Key=resultTypeStyle> <Style.Triggers> <DataTrigger Binding={Binding Result,

  • 0

I have a DataTrigger setup like so:

<UserControl.Resources>
    <Style x:Key="resultTypeStyle">
        <Style.Triggers>
            <DataTrigger Binding="{Binding Result, Path=Result.Type}" Value="Confirmation">
                <Setter Property="Control.Visibility" Value="Collapsed" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
</UserControl.Resources>

And two controls that use it:

    <TextBlock Style="{StaticResource resultTypeStyle}" FontSize="14" Grid.Row="2">Condition</TextBlock>
    <myns:ConditionBuilderView Style="{StaticResource resultTypeStyle}" DataContext="{Binding Condition}" Grid.Row="3"/>

The result type is changed by a combo box.

When the result type is Confirmation then the TextBox disappears but the ConditionBuilderView stays visible unless I remove the DataContext attribute from it.

I need to set the DataContext attribute so that the control gets the right data.

What does setting the data context do that means the visibility property no longer works?

  • 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-05-16T22:44:50+00:00Added an answer on May 16, 2026 at 10:44 pm

    You are actually changing the context used for the binding in the style of the ConditionBuilderView. So your DataTrigger looks for Result.Path on the bound Condition. If its just about Visibility this should work:

    <TextBlock Style="{StaticResource resultTypeStyle}" FontSize="14" Grid.Row="2">Condition</TextBlock>
    <ContentControl Grid.Row="3" Style="{StaticResource resultTypeStyle}" >
        <myns:ConditionBuilderView DataContext="{Binding Condition}"/>
    </ContentControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Data Trigger set-up on a Control Template <DataTrigger Binding={Binding Path=IsDragged}
I have the current DataTrigger: <DataTrigger Binding={Binding HeaderType} Value=1> <Setter Property=BorderThickness Value=5/></DataTrigger> I want
I have a problem with databinding on a style in WPF. The basic setup
I’d like to have the texblock is not visible if the value that generated
I have an Ellipse defined as so <Ellipse Stroke=#FF474747 Style={StaticResource SelectedTemplate} Fill={StaticResource RedGradient} />
I have a DataTrigger that I recently refactored. It used to have the DataContext
I have defined style for my textboxes that would show hints about what to
I have a custom WPF Line, that I whant to change the Style when
I have a TabControl on a UserControl backed by a ViewModel, and the Visibility
This is my scenario. I have 2 Properties. Type and State. Type is an

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.