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

  • Home
  • SEARCH
  • 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 1046501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:09:20+00:00 2026-05-16T16:09:20+00:00

I have DataDependentControl with dependency properties defined: TextVisibility, CalendarVisibility, ComboControlVisibility . When I select

  • 0

I have DataDependentControl with dependency properties defined:
TextVisibility, CalendarVisibility, ComboControlVisibility.
When I select some values in outside combobox with enumerated datatypes, the properties mentioned above are updated to Visibility enumeration value, but binding doesn’t update Visibility property on inside controls:

        <Views:DataDependentControl x:Name="typeValue">
            <StackPanel x:Name="container">
                <TextBox x:Name="TextBoxControl" Visibility="{Binding ElementName=typeValue, Path=TextVisibility, Mode=OneWay}"/>
                <Controls:Calendar x:Name="CalendarControl" HorizontalAlignment="Left" Visibility="{Binding ElementName=typeValue, Path=CalendarVisibility}"/>
                <ComboBox x:Name="ComboBoxControl" Visibility="{Binding ElementName=typeValue, Path=ComboControlVisibility}"/>
            </StackPanel>
        </Views:DataDependentControl>

DataDependentControl has DataType property.
According to DataType I hide or collapse child controls via following properties:
ComboControlVisibility, CalendarVisibility or TextVisibility

DataType property within DataDependentControl is defined as follows:

public static readonly DependencyProperty DataTypeProperty = DependencyProperty.Register(
            DataTypePropertyName,
            typeof (DataTypeEnum),
            typeof (DataDependentControl),
            new PropertyMetadata(ValueChangedCallback));

ValueChangedCallback function is defined as follows:

private static void ValueChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var thisObject = (DataDependentControl)d;
            var newValue = (DataTypeEnum) e.NewValue;

            switch (newValue)
            {
                case DataTypeEnum.Bool:
                    thisObject.ComboControlVisibility = Visibility.Visible;
                    thisObject.CalendarVisibility = Visibility.Collapsed;
                    thisObject.TextVisibility = Visibility.Collapsed;

….

Example of TextVisibility, CalendarVisibility or ComboControlVisibility is here:

public static readonly DependencyProperty TextVisibilityProperty = DependencyProperty.Register(
            TextVisibilityPropertyName,
            typeof (Visibility),
            typeof (DataDependentControl),
            null);

All in all:

Inside the <StackPanel/>:

If selected datatype is “string” there should be visible

<TextBox x:Name="TextBoxControl"/>

If selected datatype is “DateTime” there should be visible

<Controls:Calendar/>

If selected datatype is “Boolean” there should be visible

<ComboBox/>

DataDependentControl has “DataType” property which is defined in combobox. “DataType” is databound:

<Views:DataDependentControl x:Name="typeValue"
                                        DataType="{Binding SelectedItem, ElementName=DataTypes, Converter={StaticResource DataTypeReverseConverter}}"
  • 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-16T16:09:21+00:00Added an answer on May 16, 2026 at 4:09 pm

    Looks to me like you’re trying to your dependency properties on a ComboBox, even though they’re defined by your DataDependentControl. If the visibility of the child controls is tied to the visibility of the ComboBox, why not just do this?

    <Views:DataDependentControl x:Name="typeValue">
        <StackPanel x:Name="container">
            <TextBox x:Name="TextBoxControl" Visibility="{Binding Visibility, ElementName=typeValue}"/>
            <Controls:Calendar x:Name="CalendarControl" HorizontalAlignment="Left"  Visibility="{Binding Visibility, ElementName=typeValue}"/>
            <ComboBox x:Name="ComboBoxControl"  Visibility="{Binding Visibility, ElementName=typeValue}"/>
        </StackPanel>
    </Views:DataDependentControl>
    

    Or, even better:

    <Views:DataDependentControl x:Name="typeValue">
        <StackPanel x:Name="container" Visibility="{Binding Visibility, ElementName=typeValue}">
            <TextBox x:Name="TextBoxControl"/>
            <Controls:Calendar x:Name="CalendarControl" HorizontalAlignment="Left"/>
            <ComboBox x:Name="ComboBoxControl"/>
        </StackPanel>
    </Views:DataDependentControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.