0

Basicly this is a part of XAML that makes the parser throw XamlParseException:

<StackPanel Orientation="Horizontal" Margin="0,0,0,17">
  <Rectangle Name="settingsRectYourCity" Height="100" Width="100" 
             Fill="{StaticResource PhoneAccentBrush}" Margin="12,0,9,0" 
             MouseLeftButtonUp="settingsRectYourCity_MouseLeftButtonUp" />
  <StackPanel Width="311">
    <TextBlock Text="Your city" TextWrapping="Wrap"
                 Style="{StaticResource PhoneTextExtraLargeStyle}"/>
    <TextBlock Text="Two" TextWrapping="Wrap" Margin="12,-6,12,0" 
               Style="{StaticResource PhoneTextSubtleStyle}"/>
    <ListBox Name="settingsCityListbox" Visibility="Collapsed" 
             HorizontalAlignment="Center" FontSize="36" Margin="0,10,0,20"
             SelectionMode="Single">
      <ListBoxItem>One</ListBoxItem>
      <ListBoxItem>Two</ListBoxItem>
      <ListBoxItem>Three</ListBoxItem>
    </ListBox>
  </StackPanel>
</StackPanel>

To be even more specific, when I delete the ListBox content, all the ListBoxItems, there are no exceptions at all. What am I doing wrong?

Edit: I managed with a kind of workaround (or the only good construction of the above). I closed the plain text of ListBoxItems in a TextBlock each. I still don't know and am curios the reason, but parser won't allow plain text there. Maybe its the issue of parsing xaml for WP7.

wiktus239
  • 1,404
  • 2
  • 13
  • 29
  • 1
    What is the message of the exception? The Xaml parses fine once the external references are removed (your styles and method handler) so I can only suggest that the problem is not in the Xaml you have posted. Best guess would be the `ItemTemplate` for the `ListBox`. – Dan Puzey Sep 20 '12 at 10:47
  • The message exception is Line: 0 Position: 0. Nothing useful. The xaml I posted is directly closed in another listbox. The rest of xaml parses well, and so does this part unless I fill the ListBoxItems. – wiktus239 Sep 20 '12 at 11:08
  • Regarding your edit: the parser *does* allow plain text there. You need to post your styles, and the full text of the exception ("Line 0 Position 0", but what is the *message*?) – Dan Puzey Sep 20 '12 at 11:44
  • Actually it is the whole message. About the styles - even leaving them out won't affect the presence of the throw. – wiktus239 Sep 20 '12 at 12:28
  • Well, your markup works fine for me, and the only thing I don't have is the styles (or the surrounding markup). – Dan Puzey Sep 20 '12 at 14:37

0 Answers0