3

Windows Phone 7's People hub has an "all" panorama item with "search" and a "new" buttons right next to the header/title.

I can't seem to accomplish this with PanoramaItem in Visual Studio using the standard Panorama control. I don't know enough Silverlight/WPF either to be able to position something manually and control transitions/movement correctly.

How can I set a button (or any object, for that matter) to go alongside the header of a wp7 PanoramaItem?

Thanks!

Ramon Bosch
  • 73
  • 1
  • 6

1 Answers1

12

A PanoramaItem Header doesn't have to be a string. It could be another StackPanel that has a CheckBox in it if you wanted, something like this:

<controls:PanoramaItem>
    <controls:PanoramaItem.Header>
        <StackPanel Orientation="Horizontal">
            <TextBlock>Item</TextBlock>
            <CheckBox>CheckBox</CheckBox>
        </StackPanel>
    </controls:PanoramaItem.Header>
    <Grid>
        <TextBlock>Your Content</TextBlock>
    </Grid>
</controls:PanoramaItem>

So you can basically put anything in there that you want. Images, buttons, checkboxes, etc.

vcsjones
  • 138,677
  • 31
  • 291
  • 286
  • Sorry, I mean, this doesn't work when you have already set a Header Template on the Panorama object. – Robin Duckett Jul 30 '11 at 19:27
  • How do you access the checkbox in the codebehind to handle the selected events? – blackjid Jul 14 '12 at 17:13
  • @blackjid if you give the checkbox a name, like `x:Name="MyCheckBox"` you'll be able to access it using `MyCheckBox` in your code behind. – vcsjones Jul 14 '12 at 19:46
  • I cannot access it that way. Also there will be a Checkbox in each panorama item, how do you know wich one is in the code behind? Pleasy take a look at [this question](http://stackoverflow.com/questions/11484366/accessing-a-list-picker-inside-a-panoramaheader-template/11485900#11485900) – blackjid Jul 15 '12 at 14:06