Freigeben über


Recreating the PhoneListBoxItemLayout (and why we cut it)

One of the controls that was shipped in the Mix CTPs of Windows Phone Developer Tools was the PhoneListBoxItemLayout control. We removed this for the Beta, and naturally people are asking how to get it back.

Basically the answer is to copy the template from an App.xaml file that was created with the Mix tools, and to make it a data template for a standard Silverlight ListBox/ItemTemplate instead of for the custom PhoneListBoxItemLayout class. That gets you half way there; the other part is re-creating the properties like Title, Details, SecondaryContent, and so on. The answer here is to create a ViewModel class that best fits your needs. You can easily create a class that works the same way as the old PhoneListBoxItemLayout either by implementing INotifyPropertyChanged on your class or by using DependencyProperties, as described in this MSDN topic. I suspect though that if you were to write it yourself, you would use more meaningful property names than the generic ones we chose...

As to why we cut the feature, the basic reason was that it just made more sense to put this kind of thing into the apps rather than into the core platform. When we initially made the PhoneListBoxItemLayout class (the naming of the control is a story unto itself...) we were trying to make it as easy as possible to match the platform. We had 1- or 2-line layouts, with or without icons, and a catch-all "secondary content" in order to match the built-in application layouts. It also wasn't clear whether Blend was going to make it into the Mix CTP, and creating custom data templates in VS is not as easy as it could be, so it was important to have some nice looking templates nice out-of-the-box.

But as the 1st-party apps added more and more layouts (3 lines, items with custom highlights, etc.) and as we saw more people writing apps with custom layouts in Blend, it became clear that trying to keep up was a losing battle and would just create legacy for the platform (hint: that's not a good thing). So although it causes some pain for developers as they need to update Mix apps to run in the Beta, in the long run I think this was the right choice.

Comments

  • Anonymous
    July 20, 2010
    It makes sense to not try to anticipate every kind of layout for the listbox.  But what about the other missing controls like Quick Jump Lists, List Pickers, Date and Time Pickers, and inline list pickers?  Could someone at Microsoft consider either releasing some templates for people to use to create these, or unofficial codeplex versions of the missing controls. Layouts are one thing, but controls are essential...

  • Anonymous
    July 20, 2010
    Sorry I don't have an update on the other controls at the moment. We're know there are gaps and we want to fill them as fast as we can (in the appropriate way).

  • Anonymous
    July 21, 2010
    Well I welcome any moves towards this.  There are many missing features that devs are missing, but I am sure most are happy to know they will be coming in updates.  Missing controls just adds to this disappointment.  As a designer, I like the idea of being able to build an app without code, and for me that is harder if I am expected to build my own UI controls.

  • Anonymous
    July 21, 2010
    Well I welcome any moves towards this.  There are many missing features that devs are missing, but I am sure most are happy to know they will be coming in updates.  Missing controls just adds to this disappointment.  As a designer, I like the idea of being able to build an app without code, and for me that is harder if I am expected to build my own UI controls.

  • Anonymous
    July 21, 2010
    I think leaving it out is also more in keeping with the spirit of Silverlight, since it helps people to think about the options they have rather than try to work around the restrictions imposed by a packaged layout. That's no reason not to provide standardised date and time pickers of course :-)