<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Silverlight Controls and Silverlight Toolkit</title><link>http://forums.silverlight.net/forums/35.aspx</link><description>Discussions around using and developing Silverlight controls and the Silverlight Toolkit</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/240819.aspx</link><pubDate>Thu, 02 Jul 2009 13:32:32 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240819</guid><dc:creator>Ravi.D</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240819.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=240819</wfw:commentRss><description>&lt;p&gt;Thanks Shiva. ! Been struggling for a couple of days also !&lt;/p&gt;&lt;p&gt;Thanks a lot !&lt;/p&gt;&lt;p&gt;Regards &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/74719.aspx</link><pubDate>Fri, 25 Jul 2008 18:00:40 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:74719</guid><dc:creator>TWallace</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/74719.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=74719</wfw:commentRss><description>&lt;p&gt;Thanks so much, Shiva! I had a similar problem and your post solved it for me.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Tom &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/71006.aspx</link><pubDate>Mon, 14 Jul 2008 13:32:13 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:71006</guid><dc:creator>Ultravi0let</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/71006.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=71006</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;YYESS !! this is exactly what I needed :) Thanks a lot ! I&amp;#39;ve been struggling with it for the past 3 days ! :)&lt;/p&gt;&lt;p&gt;Thank you all for yout time. Really appreciate it.&lt;/p&gt;&lt;p&gt;Best regards,&lt;/p&gt;&lt;p&gt;Sanaa&lt;/p&gt;</description></item><item><title>Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/71001.aspx</link><pubDate>Mon, 14 Jul 2008 12:51:57 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:71001</guid><dc:creator>shiva.</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/71001.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=71001</wfw:commentRss><description>&lt;p&gt;hai,&lt;/p&gt;&lt;p&gt;try this out.&lt;/p&gt;&lt;p&gt;&amp;lt;ListBox x:Name=&amp;quot;lstCustomer&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Margin=&amp;quot;110,5,0,0&amp;quot; SelectionChanged=&amp;quot;lstCustomer_SelectionChanged&amp;quot; DataContext=&amp;quot;CustomerID&amp;quot; DisplayMemberPath=&amp;quot;ContactName&amp;quot;&amp;nbsp; HorizontalAlignment=&amp;quot;Right&amp;quot; Height=&amp;quot;100&amp;quot; Width=&amp;quot;200&amp;quot; &amp;gt;&amp;lt;/ListBox&amp;gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;private void lstCustomer_SelectionChanged(object sender, SelectionChangedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServiceReference1.Customer oCustomer = (ServiceReference1.Customer)lstCustomer.SelectedItem;//cast the selected item object to ur class type&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string strCutomerId = oCustomer.CustomerID.ToString();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;i have given example with Northwind.customer database.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Note: if this post has answered your question. plz mark it as answer&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70993.aspx</link><pubDate>Mon, 14 Jul 2008 12:18:33 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70993</guid><dc:creator>dharmesh.surti</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70993.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70993</wfw:commentRss><description>&lt;p&gt;First of all as i said did u change the (object) - with the List object that&amp;nbsp;u r using to bind with ListBox. If not then try to do that first.&lt;/p&gt;
&lt;p&gt;Or Else - Open ur application in debug mode and keep break point inside selectionchange event, open immediate window, try to get the value of&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;lb.Items[lb.SelectedIndex] -&lt;/strong&gt;&amp;nbsp;it will return the List object that u have bind with ur listbox control. That obejct will contain the selected row value that is ur categoryid and categoryname. &lt;br /&gt;&lt;br /&gt;Or else:&lt;br /&gt;In ur first post u said u used linq to sql. Can u just copy paste the code that u have used to bind with the listbox control as well as the code that u have used for selectionchange event.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70991.aspx</link><pubDate>Mon, 14 Jul 2008 12:15:20 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70991</guid><dc:creator>lee_sl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70991.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70991</wfw:commentRss><description>&lt;p&gt;SelectedItem should give you the DataItem from which you can get all the properties&lt;/p&gt;</description></item><item><title>Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70983.aspx</link><pubDate>Mon, 14 Jul 2008 11:51:23 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70983</guid><dc:creator>Ultravi0let</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70983.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70983</wfw:commentRss><description>&lt;p&gt;I get this error:&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;#39;object&amp;#39; does not contain a definition for &amp;#39;IDCategorie&amp;#39; and no extension method &amp;#39;IDCategorie&amp;#39; accepting a first argument of type &amp;#39;object&amp;#39; could be found (are you missing a using directive or an assembly reference?)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;IDCategorie doesn&amp;#39;t show when I use intellisense ..&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70977.aspx</link><pubDate>Mon, 14 Jul 2008 11:38:53 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70977</guid><dc:creator>dharmesh.surti</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70977.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70977</wfw:commentRss><description>&lt;p&gt;&amp;lt;ListBox x:Name=&amp;quot;listCategories&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; HorizontalAlignment=&amp;quot;Right&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Height=&amp;quot;100&amp;quot; Width=&amp;quot;200&amp;quot; Grid.Row=&amp;quot;2&amp;quot; Grid.Column=&amp;quot;1&amp;quot;&amp;nbsp; Margin=&amp;quot;110,5,0,0&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DisplayMemberPath=&amp;quot;LibelleCategorie&amp;quot;&amp;nbsp; Tag=&amp;quot;IDCategorie&amp;quot; &lt;br /&gt;SelectionChanged=&amp;quot;listCategories_SelectionChanged&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;/ListBox&amp;gt;&lt;/p&gt;
&lt;p&gt;In&amp;nbsp; code behind:&lt;/p&gt;
&lt;p&gt;private void listCategories_SelectionChanged(object sender, SelectionChangedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListBox lb = (ListBox)sender;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int id = (int)((object)lb.Items[lb.SelectedIndex]).IDCategorie;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;Here object will be ur object with whom u r binding the listbox.&lt;/p&gt;</description></item><item><title>Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70967.aspx</link><pubDate>Mon, 14 Jul 2008 11:05:05 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70967</guid><dc:creator>Ultravi0let</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70967.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70967</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I added the Tag Property, here is my ListBox:&lt;/p&gt;&lt;p&gt;&amp;lt;ListBox x:Name=&amp;quot;listCategories&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; HorizontalAlignment=&amp;quot;Right&amp;quot; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Height=&amp;quot;100&amp;quot; Width=&amp;quot;200&amp;quot; Grid.Row=&amp;quot;2&amp;quot; Grid.Column=&amp;quot;1&amp;quot;&amp;nbsp; Margin=&amp;quot;110,5,0,0&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DisplayMemberPath=&amp;quot;LibelleCategorie&amp;quot;&amp;nbsp; Tag=&amp;quot;IDCategorie&amp;quot; &amp;gt;&lt;br /&gt;&amp;lt;/ListBox&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;When I select a line in the ListBox, how do I get the value of this Tag property from the code behind? &lt;/p&gt;</description></item><item><title>Re: ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70963.aspx</link><pubDate>Mon, 14 Jul 2008 10:45:35 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70963</guid><dc:creator>dharmesh.surti</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70963.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70963</wfw:commentRss><description>&lt;p&gt;R u binding CategoryID column with any property of the listbox item. &lt;br /&gt;If not then bind CategoryID with the &lt;strong&gt;Tag &lt;/strong&gt;property and in the SelectedChange Event, access the tag property to get the CategoryID.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>ListBox: retrieve the SelectedItem</title><link>http://forums.silverlight.net/forums/thread/70959.aspx</link><pubDate>Mon, 14 Jul 2008 10:38:09 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:70959</guid><dc:creator>Ultravi0let</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/70959.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=35&amp;PostID=70959</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello,&lt;/p&gt;&lt;p&gt;I&amp;#39;m listing some data from an SQL Database using LINQ to SQL and WCF (I followed Jesse Liberty&amp;#39;s tutorial &lt;a href="http://silverlight.net/learn/tutorials/sqldatagrid.aspx" title="Displaying SQL Database Data in a DataGrid using LINQ and WCF" target="_blank"&gt;Displaying SQL Database Data in a DataGrid using LINQ and WCF&lt;/a&gt; to do it). My data are displayed in a LisBox (I get IDCategorie, LibelleCategorie . The ListBox shows the LibelleCategorie).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I created a SelectionChanged Event for my ListBox, and I need to retrieve the selected item, more specificaly the IDCategorie. How can I &amp;quot;read&amp;quot; MyListBox.SelectedItem ?&lt;/p&gt;&lt;p&gt;I&amp;#39;m using Silverlight 2 Beta 2, Visual Studio 2008.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Thanks in advance.&lt;/p&gt;&lt;p&gt;Regards,&lt;/p&gt;&lt;p&gt;Sanaa RAMZI&lt;br /&gt;Junior Developper&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>