Tuesday, March 6, 2012

xaml fiddling


Took a 2 day course at work that gave me a good overview of the changes available in mango, but was overall aimed at a new developer and probably not worth my entire two days. I did spend the time working on the app and updated the search to look and act like marketplace search on the device
  • Got rid of the separate search.xaml so that now it is presented in the schedulepivotview.xaml like any other view of events
  • Had to add a bunch of items to this (search header, search textbox, text to show if a view is empty) and found that if I put it all in a stackpanel, the list of events doesn't scroll (documented online in a couple of places - the list needs to be inside something with a set size, when it's in a stackpanel it thinks it has unlimited viewspace and so doesn’t need to scroll). However if I just put all the items in the top grid and hid the non-relevant ones, then the touch didn't seem to work on the pivot, presumably because other items were 'in the same place'. I worked around this by putting all the extra controls in a stackpanel that was collapsed by default, like this
  • <Grid>
    • <StackPanel>
      • <textblock search header>
      • <textbox search entry>
    • <Pivot>
    • <StackPanel>
      • <textblock empty search text>
      • <textblock empty 'my schedule' text>

  • As a bonus, this made it easy to also implement a notice when the user enters my schedule and has not yet added any items to it.

Also added an inline star to all items that are in your schedule, so you can tell without clicking on details whether you've already added this one.

No comments: