Search
Wednesday, August 5, 2020 ..:: Blendblog.net ::.. Register  Login
 Bloggers Minimize

  
 Sponsors Minimize

 Print   
 Users Online Minimize
Membership Membership:
Latest New User Latest: RodrickXcr57
New Today New Today: 0
New Yesterday New Yesterday: 0
User Count Overall: 8452

People Online People Online:
Visitors Visitors: 5
Members Members: 0
Total Total: 5

Online Now Online Now:

  
 Welcome to blendblog.net! Minimize

If you are a developer or designer who is creating cutting edge user interface experiences using Microsoft Expression Blend you've just found a great resource!  The purpose of this site is to share our experience with this brand new product.  As with any new piece of software there is a ton to discover.  Bugs will be revealed and workarounds discovered, hopefully this can be a resource to share in the discovery process!

While this site will focus largely on Expression Blend, it will also encompass WPF, Visual Studio, Silverlight, and other .net 3.5 technologies as they relate to the creation of great software.

Please login using your Microsoft LiveID or register a new account.  Doing so will let you comment on any of the blog entries on the site.  We look forward to helping you in your endeavors as well as you helping others in theirs!  We'd love to have more bloggers on our site...if you are interested please register and contact us!

Follow us:


  
 Important Fact about the ItemsCollection and fun with comboboxes Minimize
Location: BlogsSean Cullinan    
Posted by: Sean Cullinan 1/24/2008 9:42 PM

I am using an ItemsCollection to build a navigation bar in my application.  The Navigation bar has a combobox for the "address" that will track the history of a users movement through the system.  I have a dependency property of time itemscollection to sync the currently selected portion of my applciation to the navigation bar's combo box.  This is working well, except I found one limitation.  I can set the itemsource of my combobox to the ItemsCollection Dependency Property and use a DataTemplate to properly display the underlying objects in the list.  However, I wanted to bind the text property of the combobox to the first item in the ItemsCollection Dependency Property.  This seemed easy enough, the binding statement shoud be myDepObj.Item(0).myProperty.  In fact, I can do this in the code behind on a button press (set text equal to this), however binding it doesn't work.

I struggled with this for hours and could not make it work no matter what I tried.  Then I read this article at Dr. WPF which states the following:

The Items property is not backed by a dependency property. 

This means that you cannot set a binding directly on the Items property.  However, you can definitely bind an ItemsControl to a collection of items

I learned this the hard way.  So basically, when navigation occurs in code the list of items in the combobox is updated automatically as its itemsource is set to my itemscollection dependency property, but unfortunately the text is not automatically set to the top item in my itemsource the way I want.  I even tried binding the text property of the combobox to the combobox's own Items(0).URL property but that didn't work either.  Again, an individual item is NOT backed by a dependency property so it does not know to update the text property automatically.  Another promising approach that failed was to try to update the text property to the top item on the combobox's "sourceupdated" or the "targetupdated" events.  Alas these never fired when the underlying dependency object was modified. 

I then discovered a simpler way to do this....Simply setting the property IsSynchronizedWithCurrentItem on the combobox and always setting the current position on the underlying ItemsCollection the the first item acheived exactly what I wanted.  However, the combobox's selected item is not displaying the field in my datatemplate, it is instead showing the name of my object (this night is never going to end).  This is because the datatemplate is only being applied for a TextBlock which is readonly, however my combobox has IsEditable set to true so the portion of the combobox that makes up the item is not a textblock but a textbox.  Fortunately I found this forum posting at MSFT where they recommend overriding the tostring method to display what I want to display.  This worked great as I was able to display one thing in the drop down part and another thing in my textbox!

Hope this helps someone else avoid a long frustrating night like the one I've had :)

Permalink |  Trackback

Comments (1)   Add Comment
http://www.coachoutletonlinesells.com    By coach outlet online on 1/17/2015 1:44 AM
hello!<br></p><br><p>measurements <a href="http://www.coachfactoryinc.us.com"><strong>coach factory outlet 70% off -coach outlet</strong></a> bags are <a href="http://www.coachfactory-outletonline.us.com"><strong>coach factory outlet : $39 new 2015 coach outlet bags</strong></a> large though often carried by hand, the lines do not <a href="http://www.coachoutletonlinesells.com"><strong>coach outlet online - 75% off coach purses outlet</strong></a> have middle <a href="http://www.coachfactoryonlinesale.com"><strong>coach factory online - shop the latest designer bags</strong></a> ground, <a href="http://www.coachoutletfactorystore.us.com"><strong>coach factory outlet - coach outlet 80% discount</strong></a> modern, <a href="http://www.coachoutletsstoreonline.us.com"><strong>coach outlet - coach factory outlet chesterfield mo</strong></a> square or <a href="http://www.coachstoreoutlet.us.com"><strong>coach factory outlet - coach outlet 80% up clearance</strong></a> round and <a href="http://www.coachoutletstores.us.org"><strong>coach outlet online - coach handbags</strong></a> feminine. the <a href="http://www.coachfactoryoutletsale.us.com"><strong>coach factory outlet - coach outlet, Inc. - official site</strong></a> bags are carried by hand or <a href="http://www.coachstoresoutlet.us.com"><strong>coach outlet - coach outlet stores online</strong></a> under your arm, point <a href="http://www.coandtiffanys.com"><strong>tiffany and co - does tiffany have an outlet</strong></a> out that <a href="http://www.hermesbag.us.com"><strong>birkin hermes bag -hermes bag</strong></a> even the <a href="http://www.cocochanel.us.com"><strong>coco chanel handbags - coco chanel outlet- chanel bags</strong></a> clutch, <a href="http://www.hermesbelts.us.com"><strong>hermes belts - hermes belts for 70% off handbags outlet</strong></a> except for the <a href="http://www.coachfactorystoreoutlet.us.com"><strong>coach factory outlet - coach outlet sale 70% off</strong></a> small jeweled versions, lengthen the <a href="http://www.coachoutletstoresell.com"><strong>coach outlet store online - authentic coach factory stores</strong></a> flat but at <a href="http://www.coachoutletstore.us.org"><strong>coach outlet - official coach factory outlet</strong></a> the <a href="http://www.coachoutletsell.us.com"><strong>coach outlet - coach factory outlet $150+ orders</strong></a> same time <a href="http://www.coachstoresonline.us.com"><strong>coach outlet store online - coach factory outlet discount 39.99</strong></a> almost spacious. <a href="http://www.coachstoreonline.us.com"><strong>coach factory outlet - local results for coach outlet</strong></a> clutches, modern <a href="http://www.coachoutlet-store.us.com"><strong>coach outlet store online - 20% coach factory outlet stores</strong></a> backpacks, <a href="http://www.kate-spadeoutletonline.com"><strong>kate spade outlet online - kate spade jewelry outlet</strong></a> totes: this <a href="http://www.coachfactorystores.us.com"><strong>coach factory outlet store 80% discount</strong></a> about a <a href="http://www.katespadehandbags.us.com"><strong>kate spade handbags - kate spade new york crossbod</strong></a> accessory. here, <a href="http://www.valentinoshoes.us.org"><strong>valentino shoes</strong></a> all the <a href="http://www.portefeuillechanel.com"><strong>pas cher sac chanel 2015</strong></a> best, <a href="http://www.katespadeoutletstores.com"><strong>kate spade outlet - kate spade clearance</strong></a> busiest <a href="http://www.coachfactorystore.cc"><strong>coach factory outlet - store online</strong></a> bags we <a href="http://www.thenorthfaceoutletstores.us.com"><strong>the north face outlet store online</strong></a> want to grab onto. <br></p><br>despite facing <a href="http://www.katespadeoutletstores.us.com"><strong>kate spade outlet - official kate spade outlet online</strong></a> colder than <a href="http://www.michaelkorsoutletstores.us.org"><strong>michael kors outlet - michael kors stores - sale</strong></a> mars, the reality tv starlet was showing all kinds of leg as this thursday. clad in a skin-tight pencil skirt, <a href="http://www.michaelkorsoutletsonline.us.org"><strong>michael kors outlet online- factory outlet michael kors</strong></a> leather jacket <a href="http://www.michaelkorsoutlets.us.org"><strong>michael kors outlet - michael kors - official site</strong></a> and stiletto <a href="http://www.louis-vuittonoutletstores.com"><strong>louis vuitton outlet stores - Images of louis vuitton</strong></a> heels, <a href="http://www.chanelbag.us.com"><strong>chanel handbags - chanel bags - chanel outlet store</strong></a> kardashian <a href="http://www.michaelkorsoutlet-online.us.org"><strong>michael kors outlet - michael kors on sale</strong></a> any of it from <a href="http://www.michaelkors-outletonline.us.org"><strong>michael kors outlet - shop for michael kors outlet online</strong></a> and her cold <a href="http://www.chanelblackfriday.us.com"><strong>chanel black friday - fragrance and beauty</strong></a> as she grabbed lunch with pal jonathan <a href="http://www.michael-korsoutlet.us.org"><strong>michael kors outlet - michael kors handbags</strong></a> in <a href="http://www.michaelkorsoutletonlinesale.us.org"><strong>michael kors outlet online sale- michael kors</strong></a> with pride! <a href="http://www.michaelkorsoutletstore.us.org"><strong>michael kors outlet store- cheap sale 78% off online</strong></a> most powerful <a href="http://www.burberryoutletonline.us.com"><strong>burberry outlet online</strong></a> color makes for a <a href="http://www.michaelkorsoutletonline.us.org"><strong>michael kors outlet online - michael kors</strong></a> your new year, and it <a href="http://www.louisvuitton.us.org"><strong>louis vuitton - louis vuitton outlet</strong></a> also makes for the <a href="http://www.michaelkors-outlet.us.org"><strong>michael kors outlet - michael kors outlet online sale</strong></a> perfect <a href="http://www.louisvuittonstores.us.com"><strong>louis vuitton - store locator</strong></a> this <a href="http://www.louisvuittonoutlet-us.com"><strong>louis vuitton outlet - louis vuitton - official site</strong></a> pale grays and <a href="http://www.louisvuittonoutlet.eu.com"><strong>louis vuitton outlet - louis vuitton red carpet fashion louis vuitton bags</strong></a> neutrals.january I buy <a href="http://www.cocochaneloutlet.us.com"><strong>chanel outlet - chanel outlet online - sacs a main chanel</strong></a> sales.<br> we <a href="http://www.giuseppezanottishoe.com"><strong>giuseppe Zanotti shoes</strong></a> may want <a href="http://www.redbottomshoe.us.com"><strong>red bottom shoes - red bottom shoe 70% off - designer red bottom shoes</strong></a> new bag that hits the <a href="http://www.tomsshoesoutletonline.in.net"><strong>toms shoes outlet online - toms shoes outlet online free shipping - toms shoes</strong></a> market, but the fact of the matter is that we couldn't (<a href="http://www.michaelkorsoutletsstore.us.com"><strong>michael kors outlet store - save 40 - 70%. all the sales</strong></a>) actually <a href="http://www.louisvuittonhandbags.eu.com"><strong>louis vuitton handbags - louis vuitton outlet - louis vuitton outlet online</strong></a> single one. <a href="http://www.louisvuittonoutlet-online.com"><strong>louis vuitton outlet online - louis vuitton official usa website</strong></a> It's all about picking and choosing. <a href="http://www.pradaoutlet.eu.com"><strong>prada factory outlet store - prada handbags</strong></a> while the <a href="http://www.northfaceoutletonline.us.com"><strong>north face outlet - the north face jacket</strong></a> trendy piece is a justified <a href="http://www.truereligionjeans.us.org"><strong>true religion jeans - true religion brand jeans</strong></a>, what you really want to <a href="http://www.burberryhandbag.us.com"><strong>burberry handbags - outlet at prices up to 70% off. shop nordstrom rack online</strong></a> in are the <a href="http://www.sacportefeuillefr.com"><strong>sac chanel sacs a main pas cher 2015 chanel site officiel</strong></a> classics.<br> <p><br>I received not <a href="http://www.valentinoshoe.com"><strong>valentino - valentino's restaurant baltimore - valentino shoes</strong></a> one,<a href="http://www.oakleyglasses.us.com"><strong>oakley sunglasses - oakley sunglasses oil rig -oakley official site</strong></a> but two <a href="http://www.pradahandbags.eu.com"><strong>prada handbags - prada outlet online store</strong></a> monogrammed <a href="http://www.pradahandbags.us.org"><strong>prada handbags - discount prada outlet sale</strong></a> for christmas. yes, I am more <a href="http://www.ralphlaurenpolos.us.com"><strong>polo ralph lauren - ralph lauren 30% coupon code - polo ralph lauren outlet online</strong></a> a little obsessed. but I've <a href="http://www.celine-handbags.com"><strong>celine handbags - celine handbags nordstrom</strong></a> say-I don't think I'm alone. since I started carrying my cuyana <a href="http://www.marcbymarc-jacobs.com"><strong>marc by marc jacobs - marc jacobs handbags on sale</strong></a> tote, I've <a href="http://www.oakleyvault.in.net"><strong>oakley vault - oakley holbrook frogskins black friday</strong></a> four <a href="http://www.ralphlaurenoutlet.us.org"><strong>ralph lauren outlet - ralph lauren outlet mall online</strong></a> from complete strangers, <a href="http://www.ray-bansunglasses.com"><strong>ray ban sunglasses - ray ban sunglasses sunglass hut - ray ban sunglasses cockpit</strong></a> which pretty much never <a href="http://www.raybansunglasses.eu.com"><strong>ray-ban sunglasses - ray ban 3362 sunglasses</strong></a> to me.<br> I need to <a href="http://www.celinehandbags.us.com"><strong>celine handbags - celine handbags barney's</strong></a> stop myself <a href="http://www.ray-bansunglasses.us.org"><strong>ray ban sunglasses - ray ban aviator sunglasses - ray ban clubmaster sunglasses</strong></a> so <a href="http://www.truereligion.us.org"><strong>true religion outlet - official true religion outlet</strong></a> much tat, but the <a href="http://www.ralphlaurenoutletonline.us.com"><strong>polo ralph lauren outlet online - polo ralph lauren official site</strong></a> of a good discount is <a href="http://www.raybanoutletstoreonline.us.com"><strong>ray ban outlet store online - ray ban outlet</strong></a> much for me. I <a href="http://www.raybanglasses.us.com"><strong>ray ban sunglasses - ray-ban is a brand of sunglasses</strong></a> buy <a href="http://www.redbottomshoes.us.org"><strong>red bottom shoes free shipping + free exchanges. shoes and bags as low as $39.95!</strong></a> stuff that's not my size or my colour, <a href="http://www.nikeairjordan.eu.com"><strong>nike air jordan - nike air jordan release dates - nike air jordan retro 13</strong></a> and often <a href="http://www.toryburchshoes.in.net"><strong>tory burch shoes - tory burch handbags sale</strong></a> buy <a href="http://www.tiffanyandco.eu.com"><strong>tiffany and co - tiffany diamond necklaces outlet</strong></a> stuff <a href="http://www.hollisterclothing-store.com"><strong>hollister clothing store - hollister clothing for sale - hollister store online</strong></a> because it's cheap. I need a <a href="http://www.tomsoutlet.in.net"><strong>toms shoes outlet online - toms shoes on sale 80% off</strong></a> shopping <a href="http://www.truereligionoutlet.us.org"><strong>true religion outlet - cheap true religion jeans wholesale</strong></a> detox. <a href="http://www.oakleysunglasses.com.co"><strong>oakley sunglasses - cheap oakley sunglasses $9 only</strong></a> any tips? <a href="http://www.oakleysunglasses.eu.com"><strong>oakley sunglasses - military oakley sunglasses - wholesale discount oakley sunglasses</strong></a> turns <a href="http://www.toryburchoutletsstores.com"><strong>tory burch outlet - tory burch handbags 80% off</strong></a> the <a href="http://www.abercrombieandfitch.com.co"><strong>abercrombie and fitch - abercrombie 30% off coupon - abercrombie outlet sale</strong></a> traditional <a href="http://www.oakleysunglasses.us.org"><strong>oakley sunglasses - us standard oakley government sales</strong></a> concept <a href="http://www.freywillejewellery.com"><strong>frey wille jewellery - frey wille - frey wille usa</strong></a> upside <a href="http://www.abercrombieblackfriday.us.com"><strong>abercrombie black friday - abercrombie and fitch sale</strong></a> down by starting at <a href="http://www.sacchanel.com"><strong>sac longchamp - sac chanel pas cher</strong></a> high <a href="http://www.timberlandshoes.in.net"><strong>timberland shoes - timberland boots on sale</strong></a> price and working backwards. first, sign up for a <a href="http://www.abercrombieandfitch.eu.com"><strong>abercrombie and fitch - abercrombie and fitch coupons discounts</strong></a> account, <a href="http://www.truereligion-jeans.com"><strong>true religion - official true religion outlet</strong></a> and then let the fun begin!<br>


Your name:
Title:
Comment:
Add Comment   Cancel 

  
 Search Minimize

  
 Archive Minimize

  
 Blendblog Survey Minimize
Our next client application will be written using:




Which Tablet Do you expect to buy?





Submit Survey  View Results

 Print   
Copyright 2011 by blendblog.net   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2020 by DotNetNuke Corporation