<?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>Programming with .NET - General</title><link>http://forums.silverlight.net/forums/17.aspx</link><description>General discussions around authoring Silverlight .NET applications.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Re: Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/235958.aspx</link><pubDate>Sun, 21 Jun 2009 04:23:47 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:235958</guid><dc:creator>justintoth</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/235958.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=235958</wfw:commentRss><description>&lt;p&gt;OK I&amp;#39;m obviously going to give the points to the guy who agrees with me, no hard feelings. :)&lt;/p&gt;</description></item><item><title>Re: Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/235926.aspx</link><pubDate>Sun, 21 Jun 2009 01:04:00 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:235926</guid><dc:creator>jackbond</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/235926.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=235926</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/silverlight/images/icon-quote.gif"&gt; &lt;strong&gt;Krasshirsch:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;The silverlight combobox does not behave like a regular combobox, because it shouldnt.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;Gotta disagree 100%&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/silverlight/images/icon-quote.gif"&gt; &lt;strong&gt;Krasshirsch:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;The Silverlight and WPF Combobox does not have this limitation and can consist of complex visual elements on the presentation side and complex classes on the data side.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;And yet the WPF combobox behaves properly, which almost completely invalidates your argument.&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/silverlight/images/icon-quote.gif"&gt; &lt;strong&gt;Krasshirsch:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;Since there is no guarantee, that somewhere within this complex structure is actually a string that will be used as the SelectedValuePath, it would be mostly unwise to bloat the combobox with features that do only work in certain situations and environments.&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;Like the original poster said, there&amp;#39;s no reason not to detect that automatically at runtime (just as the WPF combobox does.)&amp;nbsp;For my money, while the combobox CAN be used to display arbritary content, my guess is that most of the time (particularily in LOB apps) it will be displaying text. And even if that isn&amp;#39;t true, the fact that EVERY&amp;nbsp;combobox I&amp;#39;ve ever seen (including WPF) supports this functionality, makes a pretty strong argument that that&amp;#39;s how the Silverlight one should behave. If it doesn&amp;#39;t, it just confuses the user. I mean honestly, how many times have you&amp;nbsp;seen a&amp;nbsp;combobox populated with&amp;nbsp;states, and been able to quickly&amp;nbsp;select your own with just a few clicks.&lt;/p&gt;
&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/silverlight/images/icon-quote.gif"&gt; &lt;strong&gt;Krasshirsch:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;I just typed this down without testing but it should give you an idea&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;I played around with the WPF combobox to get an idea of its behavoir. Under the hood, onkeydown is simply selecting the next item whose .ToString() method returns the first letter of the key that has been pressed. So if you add (via XAML):&lt;/p&gt;
&lt;p&gt;&amp;lt;Border&amp;gt;&amp;lt;TextBlock Text=&amp;quot;I don&amp;#39;t start with S&amp;quot; /&amp;gt;&amp;lt;/Border&amp;gt;&lt;/p&gt;
&lt;p&gt;and then (via code)&lt;/p&gt;
&lt;p&gt;&amp;quot;System.Windows.Controls.Ba&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;p&gt;&amp;quot;System.Windows.Controls.BZ&amp;quot; 
&lt;p&gt;Then pressing S will scroll through all 3 of the items (the first evaluating as&amp;nbsp;&amp;quot;System.Windows.Controls.Border&amp;quot;.) With that in mind, you simply have to jump to the next ToString that matches (cycling to the beginning if necessary, unless the shift key is being pressed, in which case, you cycle backwards.) Regardless of implementation, it really shouldn&amp;#39;t be that much code, so I don&amp;#39;t see how it could &amp;quot;bloat&amp;quot; the runtime. To go back to what I said before, not having this functionality simply confuses users. Even worse would be when some engineers (seeking consistency with standard implementations) add this on their own, while others do not. Then you&amp;#39;ve got a crap shoot, and that just can&amp;#39;t be good.&lt;/p&gt;</description></item><item><title>Re: Re: Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/235891.aspx</link><pubDate>Sat, 20 Jun 2009 21:09:59 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:235891</guid><dc:creator>justintoth</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/235891.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=235891</wfw:commentRss><description>&lt;p&gt;I completely disagree... Even if it&amp;#39;s bound to a collection of business objects, 9 times out of 10 the DisplayMemberPath is going to be a string. They could easily provide this functionality so long as that property is a string. Alternately, you could have a property for enabling it, which would throw an exception if DisplayMemberPath is not a string property of the business object.&lt;/p&gt;
&lt;p&gt;You end up making every developer face the same issue, which either cuts down productivity, or if you choose to ignore it, cuts down the usability of your application. The fact of the matter is that end-users expect the dropdown to behave the same in Silverlight as it would in an html web application. It&amp;#39;s one thing if the Silverlight combobox does more than the html one, but for it to do less is unacceptable.&lt;/p&gt;
&lt;p&gt;Thanks for the code sample, I&amp;#39;ll try it out later.&lt;/p&gt;</description></item><item><title>Re: Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/235878.aspx</link><pubDate>Sat, 20 Jun 2009 19:22:45 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:235878</guid><dc:creator>Krasshirsch</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/235878.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=235878</wfw:commentRss><description>&lt;p&gt;The silverlight combobox does not behave like a regular combobox, because it shouldnt.&lt;/p&gt;
&lt;p&gt;Since in ASP, MFC, WinForms all Comboboxes can only contain strings you can actually perform string access operations inside them, theres no harm in doing so.&lt;/p&gt;
&lt;p&gt;The Silverlight and WPF Combobox does not have this limitation and can consist of complex visual elements on the presentation side and complex classes on the data side.&lt;/p&gt;
&lt;p&gt;Since there is no guarantee, that somewhere within this complex structure is actually a string that will be used as the SelectedValuePath, it would be mostly unwise to bloat the combobox with features that do only work in certain situations and environments.&lt;/p&gt;
&lt;p&gt;So no, you have to implement those feature by urself.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="coloredcode"&gt;&lt;span class="kwd"&gt;private&lt;/span&gt; index = 0;
&lt;span class="kwd"&gt;private&lt;/span&gt; lastKey = Keys.Escape; &lt;span class="cmt"&gt;// or something which i not used often&lt;/span&gt;
&lt;span class="kwd"&gt;private&lt;/span&gt; IList&amp;lt;&lt;span class="kwd"&gt;string&lt;/span&gt;&amp;gt; list;

OnComboboxKeyUp(DependencyObject sender, KeyEventArgs e)
{
     &lt;span class="kwd"&gt;if&lt;/span&gt;(e.Key != lastKey)
     {
         list = &lt;span class="cmt"&gt;// get all entries starting with the letter represented by e.Key from the itemssource&lt;/span&gt;
         index = 0;
     }
     &lt;span class="kwd"&gt;else&lt;/span&gt;
     { 
         index++;
         &lt;span class="cmt"&gt;// check if out of bounce, return to 0 if true&lt;/span&gt;
     }
     ComboBox.SelectedValue = list[index];
}&lt;/pre&gt;&lt;pre class="coloredcode"&gt;I just typed this down without testing but it should give you an idea&lt;/pre&gt;</description></item><item><title>Re: Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/235869.aspx</link><pubDate>Sat, 20 Jun 2009 18:15:58 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:235869</guid><dc:creator>jackbond</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/235869.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=235869</wfw:commentRss><description>&lt;p&gt;I raised this issue a while back in Silverlight 2, and was hoping it would be fixed in Silverlight 3, but the beta didn&amp;#39;t get my hopes up. I know they are targetting LOB apps for Silverlight 3, and this deficiency makes the ComboBox almost unuseable. I really don&amp;#39;t understand how it got this far like this; it&amp;#39;s like the developers of the ComboBox have no idea how a ComboBox is supposed to work.&lt;/p&gt;</description></item><item><title>Re: Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/235737.aspx</link><pubDate>Sat, 20 Jun 2009 02:06:04 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:235737</guid><dc:creator>justintoth</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/235737.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=235737</wfw:commentRss><description>&lt;p&gt;:: bump ::&lt;/p&gt;</description></item><item><title>Silverlight Combobox that handles key press</title><link>http://forums.silverlight.net/forums/thread/233107.aspx</link><pubDate>Sun, 14 Jun 2009 16:36:34 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:233107</guid><dc:creator>justintoth</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/233107.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=233107</wfw:commentRss><description>&lt;p&gt;Hey all,&lt;/p&gt;
&lt;p&gt;Does anyone have a class that extends ComboBox that handles selection of items by pressing a key? And no, I don&amp;#39;t want to use the AutoCompleteBox.&amp;nbsp;I&amp;#39;m basically just looking for a ComboBox that works like the html one (which is how the built-in one should behave.) Let&amp;#39;s say we have a state dropdown, when you press m it might select Maryland, then when you press m again it might select Massachusetts. I have one that works right now but it only works for the first time you press a letter, I couldn&amp;#39;t figure out a way to select the next items with that letter. &lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the code I have so far:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://pastebin.com/m72da0672"&gt;http://pastebin.com/m72da0672&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I figure many people have already tackled this problem so didn&amp;#39;t want to reinvent the wheel. I&amp;#39;m using SL3 beta if it makes a difference. Thanks for any help...&lt;/p&gt;</description></item></channel></rss>