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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:04:27+00:00 2026-06-12T16:04:27+00:00

i want to control below process. i want to save a customer with order.

  • 0

i want to control below process. i want to save a customer with order.

enter image description here

1) Write customer’s Name,Surname,Phone
2) Select Product
3)press Insert

İ can do that above with MVVM!

but i can not :

How to show messagebox after InsertCommand? and How to activate wpf tab control’s first tab, also show in Customer Order in grid only selected product?

enter image description here

  • 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-06-12T16:04:29+00:00Added an answer on June 12, 2026 at 4:04 pm

    Can think of two ways that I’ve done that off the top of my head.

    One way is to have a control on your form which contains your message. Generally it’s visibility is collapsed, but as part of your save process you set the property that its visibility is bound to to be visible. The control becomes visible until you click the ok button, at which point it be becomes invisible.
    This is a quick easy way, for a small solution, but if you have a bigger solution then you’ll want dialogs more often – so you’ll want a more extensible solution – so you could inject a dialog service into your view models, or use messaging to get a dialog control on your window to display.

    So for example in the project I’m currently working on we’re using mvvm light and have one main window with child windows. The main window registers for the dialog message, and when the child windows publish that message it displays the dialog. so eg:

                public MainPage()
        {
            this.InitializeComponent();
    
            // http://mvvmlight.codeplex.com/discussions/209338?ProjectName=mvvmlight
            Messenger.Default.Register<DialogMessage>(this, OnDialogMessage);
    
        }
    
    
    private static void OnDialogMessage(DialogMessage message)
    {
        MessageBoxResult result = MessageBox.Show(message.Content, message.Caption, message.Button);
        message.ProcessCallback(result);
    }
    

    In the form you want to display the message you can then publish a DialogMessage and the window that has subsrcibed to that message will display it. We’re currently using a ServiceLocator to handle the finding our message box service, although depending on your project it may be preferable to inject this.

    ServiceLocator.Current.GetInstance<IMessageBoxDisplayer>().Show(
                            "Selected Product has been saved", "Product Saved", false);
    

    Then your messageBoxDisplayer will then Show the messagebox by publishing the message:

        public Task<bool> Show(string messageBoxText, string caption, bool displayCancelButton)
        {
            if (caption == null)
            {
                throw new ArgumentNullException("caption");
            }
    
            var tcs = new TaskCompletionSource<bool>();
    
            var message = new DialogMessage(messageBoxText, mbr => tcs.SetResult(mbr == MessageBoxResult.OK))
                {
                    Button = displayCancelButton ? MessageBoxButton.OKCancel : MessageBoxButton.OK,
                    Caption = caption,
                };
            Messenger.Default.Send(message);
    
            return tcs.Task;
        }
    

    Obviously there’s more code needed than this to implement the messaging service, the service locator etc, but this should give you the general gist of some possible ways of doing it. If you’re already using a framework then chances are you’ll have much of this in place, if not possibly worth looking into.

    Check out this discussion on mvvmlight dialogmessage and dialogboxes:
    http://mvvmlight.codeplex.com/discussions/209338?ProjectName=mvvmlight

    edit:
    Just noticed second part of question.
    To activate the second tab, depends how you’ve created it. TabControl is essentially an items control so you can bind its item source to a collection of viewmodels, and then bind the SelectedItem to an ActiveTabViewModel property on your windows viewmodel (Mode=TwoWay), then you can set the ActiveTabViewModel to be the one you want and it should change. Alternatively I suppose you could probably bind the SelectedIndex (although I haven’t tried it this way myself yet) eg:

    <TabControl SelectedIndex="{Binding SelectedTabIndex, Mode=TwoWay}"/>
    

    and on the view model have the property:
    public int SelectedTabIndex
    {
    get
    {
    return _selectedTabIndex;
    }

            set
            {
                this._selectedTabIndex = value;
                this.RaisePropertyChanged(() => this.SelectedTabIndex);
            }
        }
    

    assumes you have a RaisePropertyChanged event that handles the NotifyPropertyChanged – if you’re using mvvmlight this should be there.

    Then in your save method set SelectedTabIndex = x and it should hopefully change tothe correct tab.

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

Sidebar

Related Questions

My friend done this below coding for custom control <a href=javascript:__doPostBack('id','msg');>click</a> now i want
I want to control the mouse pointer with my application and be able to
I want to control does an element exist in document with its ID, when
i want to control my tab pages with custom buttons...now i want to hide
I want to control domainUpDown as spinner to control value from 0 to 800
I want to control the x and y axis of a multi series line
I'm currently working on a project where I want to control a microprocessor (Arduino)
I am building a custom web panel control for specific purpose.I want the control
i am working with jquery for animate a div. i want to control speed
How can I use variables to set my timer? I want to control delay

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.