How to cancel ComboBox change?

Let's analyze the following scenario. Window contains a combo box. When user changes the value, under some circumstances, it may cause data loss, so program asks user, whether he really want to change this value. If he answers "No", value in the
combo box should remain unchanged.
Here's XAML part of the PoC:
<Window x:Class="BindingProblem.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<ComboBox ItemsSource="{Binding ItemsSource}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</Window>
And there's code-behind part (for simplicity, windows is its own DataContext):
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BindingProblem
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window, INotifyPropertyChanged
private int selectedItem;
private void SetSelectedItem(int value)
if (MessageBox.Show("Are you sure?", "Test", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
selectedItem = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem"));
else
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem"));
return;
public MainWindow()
InitializeComponent();
ItemsSource = new List<int>() {1, 2, 3, 4, 5};
DataContext = this;
public List<int> ItemsSource
get;
private set;
public int SelectedItem
get
return selectedItem;
set
SetSelectedItem(value);
public event PropertyChangedEventHandler PropertyChanged;
Try:
Run the program
Choose "1" in combo box
Choose "Yes". Value in the combo box will change to "1"
Choose "2" in combo box
Choose "No". Value in the combo box will change to "2" despite that value in the viewmodel will remain "1".
What's interesting is that property getter is actually being called during execution of the setter. But combo box still displays incorrect value.
How can I fix that?

>>What's interesting is that property getter is actually being called during execution of the setter. But combo box still displays incorrect value.
>>How can I fix that?
Just raise the PropertyChanged using the dispatcher:
private void SetSelectedItem(int value)
if (MessageBox.Show("Are you sure?", "Test", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
selectedItem = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem"));
else
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("SelectedItem"));
return;
Then the event will be raised after the ComboBox control have sets its internal selection.
Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

Similar Messages

  • HT1918 how to cancel itunes match

    How do I cancel this?  I emailed this useless **** at apple and she gave me the wrong ansewer.  I already did put no renew of itunes match. 
    anyone know how to cancel this?
    Hello Ari,
    Lisa here, from iTunes Store Support. I understand that you would like to cancel your iTunes Match subscription. I am sure you are eager to have this issue resolved and I would be happy to assist you today!
    Please note that if you have an iTunes Match subscription, you can't change countries until the subscription has expired. Your subscription expires 08/18/2013.
    To turn off Auto-Renew for iTunes Match, follow these steps:
    1) Open iTunes.
    2) From the pull-down Store menu in the menu bar, Choose Store > Sign In.
    3) Enter your iTunes Store account name and password, then click Sign In.
    4) Go to the Store menu again, Choose Store > View My Account.
    5) Enter your account name and password a second time, then click View Account.
    You will be taken to your Apple Account Information page. On this page, simply click the "Turn Off Auto-Renew" button next to iTunes Match.
    For more information about iTunes Match, visit:
    http://www.apple.com/icloud/features/
    http://www.apple.com/itunes/whats-new/
    I hope this information is helpful! Please let me know if you require any further assistance with your account, as if you do, I would be glad to help. Thank you very much for being part of the iTunes Store family, Ari. I hope you have a great day!
    Sincerely,
    Lisa
    iTunes Store/Mac App Store Customer Support
    http://www.apple.com/support/itunes/ww
    Thank you for allowing me the opportunity to assist you.
    First Name : ari
    Last Name : newman
    Email : [email protected]
    Apple ID (Optional) : [email protected]
    Lang_Country : en_AU
    Product : iTunes Store
    Support Subject : Purchases, Billing & Redemption
    Sub Issue : itunes match
    GCRM Case ID : 413932684
    See additional info below
    Choose the iTunes Store or App Store for your country:  Australia
    Item title:  how to cancel itunes match
    Order number: 
    Details:
    Hi how do I cancel my itunes match?  I dont use and I am moving countries soon.  please let me know what I need to do to cancel iTunes Match?
    thanks
    © 2013 Microsoft
    Terms
    Privacy
    Developers
    English (United States)
    © 2013 Microsoft
    Terms
    Privacy
    Developers
    English (United States)

    Brian,
    Again, not accurate. When Match is "turned off" all of the Matched song instances are still shown in the Ibrary and all devices still stream - so, if you have your songs also stored on your local drive (which I choose to as one does not always have access to WiFi and I use the local instances of the songs for some music production/DJing), iTunes shows each song twice.  This is cumbersome if you simply want to play an album - you have to hear each song twice. There is no reason technologically they could not simply show the metadata for a song only once and simply hit the cloud object store when it it is not found as a local disk target. This would solve some of the issues and it is pretty much how any content delivery network (CDN) works - and this is how my local Genius Bar assured me it would work before I bought the service. I found they know little about Match.
    Other issues: I believe the "exclusive" Cloud Playtlist logic still stands - iTunes protests if you add a non-Matched song to a Playlist (as it assumes you want all Playlists to be cloudy). Also, the APLCARE person and I  could not figure out what "Removed" (under Cloud Status) means despite looking up several explanations on the Web. And, we found songs that were only in the cloud that should have also been on my local drive as I never deleted them. That said, it is also a pain to fully delete a song (local + the cloud). Plus, the logic in the Purchased section around what constitutes "Not On Computer" did not hold up. They have lots of logical challenges with thier workflow.
    Regardingyour suggestion, there is no way to "not use" Match. Only when one is disconnected from the iTunes store does Match seem to go away completely.The only thing you can turn off is the song syncing/matching/uploading. This amounts only to turning off a sub-process not the service.
    Match is likely fine for most who do not want to have any copy of the songs locally and are fine having access to their music only when connected via WiFi. I wanted more ubiquitous access to my collection from my iPad and my iPhone but needed to keep my songs local to my MBP too. This is not the proper use case as I have learned.
    Of course I won't renew, but I should be able to cancel a service that I am dissatisfied with.

  • How to cancel an idoc in status 64

    How to cancel an idoc in status 64

    Hi Manju,
    If you have table updation access then
    Go to SE16 --> Table EDIDC --> Give your "IDoc number" -->  change the status from 64 to "73 IDoc archived".
    Or you can ask to your ABAPer to do that.
    Hope it helps,
    Regards,
    MT

  • Excise base amount in LOcal currency in J1IG and How to cancel old

    Hi,
    I have two query for depot plant
    1: In case of import material PO currcny is JPY,  now after PO I have done the GR  then ref. to GR number  I am doing the J1IG  in J1IG  in the column  Excise base the default amount is coming from the PO  but it is in PO currency  JPY , we required this amount in INR,  so is there any setting for this.
    2: Aftre PO i have made the   GR  then ref. to GR  i have create the RG entry  with   J1IG  ,  but there is some problem  in the RG entry  so i want to reverse / cancel  that,  which step to be follow for this  My  GR is OK , i read in some thered  it can be done with J1IJ  but how to cancel it .
    regards,
    zafar

    Hi
    1.     Since you are doing this for depot with foreign currency, like you entering all the excise values for 4 duties manually you have to change Excise base value also manually in INR.
    2.     For cancelling the RG23D entry, go from J1IG itself, when you enter in J1IG you can see 4 tabs at the top, select the last tab with cross on it give your material document no and excise group , year and enter then just save system will ask you to confirm and save, then extract RG23D by J2I5 & then with J2I6 you will see it is deleted.

  • How to cancel "set up personal domain"

    Does anyone know how I cancel the "set up personal domain" in iWeb 2.0? I changed my mind halfway through the set-up process (I clicked Personal Domain in my Account Settings, entered my domain name, but haven't defined my CNAME on my registrar's website). Now it looks like I can't access either my iWeb files OR my personal domain name! Thanks for your help!
    Sharon

    Help!
    I am struggling to get my domain name set up.
    Domain: www.west3.org
    .Mac website: http://web.mac.com/mrcommitment/West3_residentsAssociation/Welcome.html
    CNAMe record set up with Dotster as
    web.mac.com.west3.org CNAME www.west3.org
    All is set up as above and I've waited the requisite time, name servers are as required by Dotser
    BUT no access to via personal domain.
    Any advice welcome
    Ben

  • How to cancel screensavers ?? thanks a lot!

    anybody help me pls,
    how to cancel "screensavers" --- this application program in solaris 2.6 open windows environment?
    thanks a lot!!

    Hi
    Your question is very clear. What do you mean by "Screensavers" ? Are you referring to the Solaris screen savers that appear on the screen when you leave the system with no activity for a while or are you referring to some program called screensavers ?
    In case of the first, it is very simple.
    Assuming you have Openwindow desktop,
    1. DO a click on the right mouse button in an empty area of the workapce.
    2. Select Properties
    3. Click the Category section drop down window.
    4. Select Miscellaneous
    You will see that a Screen Saver On/Off button which can
    be put to off or put in on "auto" with timeout minutes specified.
    Change it as you please.
    If you have a CDE environment,
    Just run /usr/dt/bin/dtstyle and select Screen icon.
    It will show you the details of the screen saver settings.
    HTH
    Shridhar

  • Did anyone have an answer to how to cancel online ...

     how to cancel online phone number??  i'm wasting alot of time on this?  they make it easy to get the number , but give no info how to cancel? help?

    Hi, and welcome to the Community,
    If you can not cancel the subscription from your account (where subscriptions and credit are managed), please contact Skype Customer Service.  Here is a link to the instruction on how to contact Skype Customer Service via their secure portal: Contact Customer Service
    As you know you wish to contact Customer Service, skip past Step 2 of the instruction and proceed to Step 3, Continue Support Request.
    Go to the Support request page.
    Select the topic you need help with and the problem you’re experiencing. Some information that might help with your problem is displayed.
    If you still feel that the information doesn’t help, click the Continue support request button at the bottom of the screen.
    Select your contact method. We recommend that you check our Support Network first.
    If you chose email, enter your details, describe your problem, and then click Send support request. We'll get back to you as soon as we can.
    We don’t currently provide telephone support.
    Hope this helps.
    Best regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Mass Cancel/ Mass change of a product across all orders

    Dear Friends,
    We have a typical requirement at our client:
    1.How to cancel a product across multiple orders (Mass Cancel) ?
    2.How to change a product acorss multiple orders (Mass change in all orders)
    They had a issue with one of the product and to be cancelled due to legal requirements..but we have had the orders ready, which include other materials also.
    We now want to change one Material across all orders..how to do this? Same is the case wtih Mass Cancellation requirement.
    I request you to help us on this.
    Thanks
    Ravi
    Edited by: Ravi Prasad on Nov 24, 2008 4:38 PM

    Dear Ravi
    1)  To cancel in mass, you have to create a recording in LSMW and upload the text file
    2)  To change a material in multiple sale orders, go to VA05, input the material code and execute.  There from top menu bar, click on "Edit -- Mass Change -- New Material"
    thanks
    G. Lakshmipathi

  • CVI2013 f1: how to cancel build process?

    how to cancel the build process after it's started?
    I can't find a way...
    Vix
    In claris non fit interpretatio
    Using LV 2013 SP1 on Win 7 64bit
    Using LV 8.2.1 on WinXP SP3
    Using CVI 2012 SP1 on Win 7 64bit, WinXP and WinXP Embedded
    Using CVI 6.0 on Win2k, WinXP and WinXP Embedded
    Solved!
    Go to Solution.

    Hello Wolfgang!
    Yes, my answer to vix's initial question was basically the same as your's: the 'Cancel Build' menu item from the Build menu.
    As of CVI 2013, the build process is not longer blocking the ADE UI anymore, so users can operate the CVI ADE independent of the currently running build process. Hence, the modal dialog from CVI 2012 has been removed. Because the dialog was removed, we moved the ability to cancel the current build over to the CVI ADE menu, amoung the other menu items related to the build process (e.g. Build, Rebuild, Batch Build...). However, we didn't want to modify the behavior of the STOP button, because it's main purpose has been closely targeted towards controlling the execution state of a debugged program. If we have changed it's behavior, we would also have to change it's naming, i.e. currently 'Terminate Execution' toolbar button.

  • How to cancel Rep. manufacturing Insp Lot

    Dear All,
    I have inspection lot with Inspection Type 13 [Rep. Manufacturing], which is having CRTD PASG status.
    When I go to menu
    Insp Lot---->functions -
    > Cancel this has deactivated/Hide mode.
    Please suggest how to cancel this lot
    Regards
    Honyal

    Dear,
    You can used QAC1 to correct the inspection lot quantity.
    Make the inspection lot quantity to 0. This can be one of the way.
    OR Change inspection Lot QA02 / Inspection lot / function /cancel lot and save it
    Or go to QA02 enter the lot no then chage the status to REL.
    Regards,
    R.Brahmankar

  • How to cancel my suscription

    Hi ! I'm from Latinoamerica and I'm trying to cancel my suscription, but I don't find the option to cancel it, I try calling to Support but isn't working, if anybody knows how to I'll be thankfull

    You need Adobe support to cancel a subscription
    -cancel http://helpx.adobe.com/x-productkb/policy-pricing/return-cancel-or-change-order.html
    -or http://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html
    -or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html

  • How to cancel an running load

    Hi Gurus,
         I wanted to know how to cancel an running load..is it to change the status into red n deleted it from the cube..??
       once i did it like this in my system but after sometime the laod again automatically converted into green n continue its loading..
    can anyone tell me on how to cancel an running load...
    waiting for reply
    Ravi

    Hi,
    First and foremost let me advice you to be very careful while doing this.
    You can start from SM37, find the process WID/PID then go to SM50 or SM51 and kill it. Once its done come back to RSMO and check the request, it should be red but again manually force to red and save by clicking on the total status button in the status tab. This shuld ensure that the process is killed properly.
    The next step will be to go to targets that you were loading and remove the red requests from those targets.
    Note: For source system loads you may have to check if the request is running in the source system and kill if needed and pull it again.
    But for BW datamart delta loads u may have reset the datamarts in case u are going to pull the delta again.
    Thanks,
    JituK

  • How to cancel trade/customs check function?

    Dear JP,
    Can you tell me how to cancel trade/customs check function? when i create an invoice, the system always checks the trade/customs tap, if i don't input the relevant data, the invoice won't generate account.

    Hello There,
    Check in IMG >SD > Foreign Trade / Customs > Basic Data for Foreign Trade > Define Business Transaction Types And Default Value > Define Default Business Type (SD).
    Also check in tcode VI49.
    OR
    Also, check based on your business process requirment, use tcode VTFA/VTFL,
    Header - Determine export data.
    OR
    Please go through SAP Note :354222 and 354118.
    Take a ABAPer help and Make the Changes according to that.
    Also, refer Re: Foreign Trade Data Issue
    Thanks & Regards
    JP
    I request you, not specify any name, while posting your query on forum.

  • Cannot cancel Urgent Change document in Solman 7.1

    Hi all,
    After we upgraded to Solman 7.1, we found that the Urgent Change documents in CHARM are not allowed to be withdrawn/cancelled when tranports have already been imported to QA system.
    In previous Solman 7.0, we were able to cancel/withdraw Urgent Correction documents using report CRM_SOCM_SERVICE_REPORT even when transports has already been moved to QA.
    Any idea how we can cancel Urgent Change documents in Solman 7.1?
    Thanks,
    Tess

    The question is how to do it? the end-user when open a CR will not do it and the receiver (service desk) can not waste his tiem doing it
    Its a consulting issue.....not technical...who shd do is more like a process....so you know better in your current case.
    Yes, but ths stnadard tool allow to do it or a Z programm is needed? Which type of inconsistences could appear?*
    there is a standard report
    CRM_SOCM_SERVICE_REPORT
    but remember handle with care.
    hope it resolves
    regards
    prakhar

  • How to cancel My Free adobe trial

    I signed up for an adobe free trial contract 2 days ago and was charged $23.88 and was charged right away. I thought that in 30 days I would be charged. I succesfully down loaded reader 9 but it says that the file could not be found. How can I delete this charge?
    I hope someone can solve my problem for me. :-(

    This is an open forum, not Adobe support... You need Adobe support to cancel a subscription
    -start here https://forums.adobe.com/thread/1703848
    -or by telephone http://helpx.adobe.com/x-productkb/global/phone-support-orders.html
    --and two links which may provide more details, if the above links don't help you
    -http://helpx.adobe.com/x-productkb/policy-pricing/return-cancel-or-change-order.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

Maybe you are looking for