<!-- index.php -->
{"id":40,"date":"2011-07-11T18:58:00","date_gmt":"2011-07-11T16:58:00","guid":{"rendered":"http:\/\/pustekuchen.xn--burkfrulein-q8a.de\/?p=40"},"modified":"2011-07-11T18:58:00","modified_gmt":"2011-07-11T16:58:00","slug":"set-selectedindex-in-a-selectionchanged-event","status":"publish","type":"post","link":"https:\/\/blog.bur-k.de\/?p=40","title":{"rendered":"Set SelectedIndex in a SelectionChanged Event"},"content":{"rendered":"<p>Hello folks,<\/p>\n<p>today i got a wierd problem in my Silverlight Application. I had two Comboboxes, i wanted to change the items of the second Combobox, when i select a value in the first Combobox.<\/p>\n<p>But the second Combobox still showed another value. After spending some time with google i found this <a title=\"Silverlight Forum\" href=\"http:\/\/forums.silverlight.net\/forums\/p\/67956\/224601.aspx\">topic.<\/a><\/p>\n<p>The solution to that Problem is the following.<\/p>\n<div>\n<table>\n<tbody>\n<tr>\n<td>\n<pre>private void cmbOne_SelectionChanged(object sender, SelectionChangedEventArgs e)\n{\n    cmbTwo.Dispatcher.BeginInvoke(new Action(() =&gt; { cmbTwo.SelectedIndex = 0; }));\n}<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The <a href=\"http:\/\/msdn.microsoft.com\/de-de\/library\/system.windows.threading.dispatcher.begininvoke.aspx\">BeginInvoke<\/a> Method executes the specified delegate asynchronously with the specified arguments on the thread that the <a href=\"http:\/\/msdn.microsoft.com\/de-de\/library\/system.windows.threading.dispatcher.aspx\">Dispatcher<\/a> was created on.<\/p>\n<p>Now its works how it should. I hope it will help someone <img decoding=\"async\" alt=\":)\" src=\"http:\/\/www.mycodeland.com\/wp-includes\/images\/smilies\/icon_smile.gif\" \/><\/p>\n<div class=\"twoclick_social_bookmarks_post_40 social_share_privacy clearfix 1.6.4 locale-de_DE sprite-de_DE\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_40')){$('.twoclick_social_bookmarks_post_40').socialSharePrivacy({\"services\":{\"facebook\":{\"status\":\"on\",\"txt_info\":\"2 Klicks f\\u00fcr mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k\\u00f6nnen Ihre Empfehlung an Facebook senden. Schon beim Aktivieren werden Daten an Dritte \\u00fcbertragen - siehe <em>i<\\\/em>.\",\"perma_option\":\"off\",\"action\":\"like\",\"language\":\"de_DE\"},\"twitter\":{\"reply_to\":\"\",\"tweet_text\":\"%20Set%20SelectedIndex%20in%20a%20SelectionChanged%20Event%20%C2%BB%20pustekuchens%20Blog%20%23Combobox%20...\",\"status\":\"on\",\"txt_info\":\"2 Klicks f\\u00fcr mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k\\u00f6nnen Ihre Empfehlung an Twitter senden. Schon beim Aktivieren werden Daten an Dritte \\u00fcbertragen - siehe <em>i<\\\/em>.\",\"perma_option\":\"off\",\"language\":\"de\",\"referrer_track\":\"\"},\"gplus\":{\"status\":\"on\",\"txt_info\":\"2 Klicks f\\u00fcr mehr Datenschutz: Erst wenn Sie hier klicken, wird der Button aktiv und Sie k\\u00f6nnen Ihre Empfehlung an Google+ senden. Schon beim Aktivieren werden Daten an Dritte \\u00fcbertragen - siehe <em>i<\\\/em>.\",\"perma_option\":\"off\",\"referrer_track\":\"\"}},\"txt_help\":\"Wenn Sie diese Felder durch einen Klick aktivieren, werden Informationen an Facebook, Twitter, Flattr, Xing, t3n, LinkedIn, Pinterest oder Google eventuell ins Ausland \\u00fcbertragen und unter Umst\\u00e4nden auch dort gespeichert. N\\u00e4heres erfahren Sie durch einen Klick auf das <em>i<\\\/em>.\",\"settings_perma\":\"Dauerhaft aktivieren und Daten\\u00fcber-tragung zustimmen:\",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/blog.bur-k.de\\\/?p=40\",\"post_id\":40,\"post_title_referrer_track\":\"Set+SelectedIndex+in+a+SelectionChanged+Event\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div>","protected":false},"excerpt":{"rendered":"<p>Hello folks, today i got a wierd problem in my Silverlight Application. I had two Comboboxes, i wanted to change the items of the second Combobox, when i select a value in the first Combobox. But the second Combobox still&#8230; <a class=\"more-link\" href=\"https:\/\/blog.bur-k.de\/?p=40\">Weiterlesen &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[31,98,99,170],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-c","category-silverlight","tag-combobox","tag-selectedindex","tag-selectionchanged","tag-silverlight"],"_links":{"self":[{"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=40"}],"version-history":[{"count":0,"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=\/wp\/v2\/posts\/40\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bur-k.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}