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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:47:55+00:00 2026-05-21T19:47:55+00:00

I have a child control that has a checkbox and webbrowser: <UserControl x:Class=Some.MyUserControl etc.>

  • 0

I have a child control that has a checkbox and webbrowser:

<UserControl x:Class="Some.MyUserControl" etc.>
  <Grid>
    <CheckBox x:Name="chkA" Content="Analysis" Checked="chkA_Checked"></CheckBox>
    <WebBrowser Margin="0,30,0,0" Name="wbA"></WebBrowser>
  </Grid>
</UserControl>

I am putting this control in my MainWindow.xaml/.cs:

<Window x:Class Some.MainWindow xmlns:local="clr-namespace:Some" etc.>
  <Grid>
    <local:MyUserControl x:Name="MyUserControl_Main"></local:MyUserControl>
  </Grid>
</Window>

My question is how can my MainWindow know that the CheckBox (chkA) has been checked? So far only the actual user control knows it has been clicked? How can I expose the “Checked” event for my MainWindow to see? Or is there a better way?

I’ve searched the web, but can’t seem to wrap my head around what I’m seeing.

Thank you in advance,

-newb

EDIT 1:

I am trying the following with no luck, but may be on the right track.

Within my MainWindow.xaml.cs I have added:

public static readonly RoutedEvent CheckedEvent = EventManager.RegisterRoutedEvent("Checked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyUserControl));

public event RoutedEventHandler Checked
{
    add { AddHandler(CheckedEvent, value); }
    remove { RemoveHandler(CheckedEvent, value); }
}

And within MyUserControl.xaml.cs I have added:

private void chkA_Checked(object sender, RoutedEventArgs e)
{
    RoutedEventArgs args = new RoutedEventArgs(MainWindow.CheckedEvent);
    RaiseEvent(args);
}

EDIT 2:

Moved previously mentioned code into MyUserControl.xaml.cs:

public static readonly RoutedEvent CheckedEvent = EventManager.RegisterRoutedEvent("Checked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyUserControl));

public event RoutedEventHandler Checked
{
    add { AddHandler(CheckedEvent, value); }
    remove { RemoveHandler(CheckedEvent, value); }
}

private void chkA_Checked(object sender, RoutedEventArgs e)
{
    RoutedEventArgs args = new RoutedEventArgs(MainWindow.CheckedEvent);
    RaiseEvent(args);
}

And now I am able to see the “Checked” event “Bubble” up as so:

<Window x:Class Some.MainWindow xmlns:local="clr-namespace:Some" etc.>   
  <Grid>     
    <local:MyUserControl x:Name="MyUserControl_Main" **Checked="MyUserControl_Main_Checked"**></local:MyUserControl>   
  </Grid>
</Window>

Thanks @Matt for the tip!

EDIT 3:

Matt’s first answer is the best way to go, I had it “Checkbox” vs “CheckBox”… Adding CheckBox.Checked to the grid catches the event:

  • 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-21T19:47:55+00:00Added an answer on May 21, 2026 at 7:47 pm

    Let the Checked event bubble up to the parent and catch it there. It’s the beauty of routed events!

    <Grid CheckBox.Checked="CheckBox_Checked">
        <local:MyUserControl x:Name="MyUserControl_Main" />
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user control that has a grid (the one you get automatically
I have an object of class Level that has several subsystems (child objects) it
Ok, so I have this control that has some other controls on it. I
I have a UserControl that has some javascript I'd like to inject into a
I have my own control, derived from TCustomPanel . It has a child (
I have an application that has a ListView control with scrollbars, and it has
I have a user control that needs to load a child control when a
I have a .Net Panel control that contains a single child control that is
I have a data entry web app where the control that has focus is
I have a C# .NET 2.0 WinForms app. My app has a control that

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.