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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:38:00+00:00 2026-05-13T14:38:00+00:00

I have a Silverlight Usercontrol where I have a tabcontrol which uses a couple

  • 0

I have a Silverlight Usercontrol where I have a tabcontrol which uses a couple of tabitems. Now each tabitem is another Usercontrol. I was wondering if there is a way to access an object of one of these usercontrol tabitems.

For example if I have a xaml in my main usercontrol:

<controls:TabControl x:Name="TabControl" Grid.Row="1" Grid.Column="1" Foreground="#234BC3">
            <controls:TabItem Header="Prestaties" x:Name="TabPres" Visibility="Collapsed">
                <nsl:PrestatiesUC></nsl:PrestatiesUC>
            </controls:TabItem>
            <controls:TabItem Header="Protocollen" x:Name="TabProt" Visibility="Collapsed">
                <nsl:ProtocollenUC></nsl:ProtocollenUC>
            </controls:TabItem>
            <controls:TabItem Header="Adt" x:Name="TabAdt" Visibility="Collapsed">
                <nsl:AdtUC></nsl:AdtUC>
            </controls:TabItem>
        </controls:TabControl>

And in my PrestatiesUC usercontrol i have an object:

<Button x:Name="btnReSend" Content="Resend" Width="75" Height="25" Margin="10" Click="resend_Button"/>

How would I go about disabling it’s visibility on startup dynamicly in the main usercontrol code?

I tried things like:

PrestatiesBAMUC tmp =  new PrestatiesBAMUC();
tmp.btnReSend.Visibility = Visibility.Collapsed;

But this didn’t work.

Any ideas?

  • 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-13T14:38:00+00:00Added an answer on May 13, 2026 at 2:38 pm

    In the main user control Loaded event this should work:-

    ((PrestatiesUC)TabPres.Content).btnReSend.Visibility = Visibility.Collapsed;
    

    However it smells bad. Its generally not a good idea to have something like the main page have such intimate knowledge of how a UserControl is structured internally.

    Would it not be better to have the “Prestaties” set the buttons visibility in is Loaded event?

    If not the create some Interface that is implemented by PrestatiesUC (and likely the other Usercontrols involved). During Loaded in the main page simply enumerates over the set of tabs and calls a method on this interface passing in some state object. The Usercontrols then make choices about that status of the controls it contains.

    If that seems over the top then at least add a property to the user control to hide the button itself:-

     // In PrestiesUC
     public bool ReSendVisible
     {
        get { return btnReSend.Visibility == Visibility.Visible; }
        set { btnReSend.Visibility = value ? Visibility.Visible : Visibility.Collapsed; }
     }
    

    Now your code in the main user control would look like:-

    ((PrestatiesUC)TabPres.Content).ReSendVisible = False;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.