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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:43:30+00:00 2026-05-25T19:43:30+00:00

I have a Custom TabControl in a WPF application (attention: the technology is not

  • 0

I have a Custom TabControl in a WPF application (attention: the technology is not important as it may change) that contains TabItems. Each TabItem has a text, and a ‘x’ button to close the tab.

The request is to add some features to the close functionality in order to change it’s default behavior (the simple closing). What I need to do is simply to check if some data displayed inside the screen have changed, and if so to prompt the user with some MessageBox to inform him that some changes were made in that tab.

The MessageBox will display the message “Some changes have been made to the data. Do you want to save them?”, and will have the options:

  • Yes – Save Changes then close tab;
  • No – Do not save them and close tab;
  • Cancel – Do nothing, do not save, do not close;

There is no issue with detecting if changes have been made to the scree, due to the fact that I simply set some property HasChanged whenever any change has been made to the data.

For now, the only solution I thought of was to extend the Control, and implement a new close event. This solution will do for now, because I have to do only one change to the tabs behavior. The problem is that I might need to extend the functionality in other way in the future, and I don’t want to extend the TabControl every time the request is changing.

Also I need to keep the default behavior of the TabItem (the simple close).

Can anybody point me out to some optimum solution, to be easily extended with different behaviors, and also portable on any .NET application.

Thank you.

  • 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-25T19:43:31+00:00Added an answer on May 25, 2026 at 7:43 pm

    Given that you already have defined a custom control, then I would suggest adding a new event such as OnTabClosing which is fired before your custom control closes the tab. This way you can add custom functionality to a tab being closed, without having to keep extend the control itself. The link should provide all the information you need to get started with that.

    You can also take a look at Routed Events if your interested in making this available within XAML for storyboard animations as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which has a tabcontrol that contains two tabpages. I have
I'm building a custom WPF control that derives from TabControl. In the ControlTemplate, I'm
I have a complex WPF control that for some reasons (ie. performance) is not
I have custom groupViews that need to change state when they are expanded and
Problem I have a custom tab control using Chrome-shaped tabs that binds to a
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a few models that need to have custom find conditions placed on
I have a class that extends TabControl, basically to have one with the tabs
I have custom drupal module. I receive result from a webservice that I need
I have custom SiteMapProvider and RoleProvider that works together properly: IsAccessibleToUser returns false if

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.