Reputation: 115
I am trying to use a listbox to display a custom UserControl. It had been working just fine until recently i started recieving an "invalid xaml" error message and am no long able to refresh the Design View.
The error does not keep the app from compiling and running.
I have tried everything i can think of. I created a test control and a test page from scratch and only get the error when i put the control in the data template. I can put any standard control into the data template without error. only errors on a custom usercontrol.
here is the page:
<phone:PhoneApplicationPage
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WP7ListBoxSelectedItemStyle"
xmlns:my="clr-namespace:testproject.Controls"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
x:Class="WP7ListBoxSelectedItemStyle.TestPage"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="8,17,16,-17">
<ListBox Name="lb_test"
Margin="0,0,0,0">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<my:Test1></my:Test1>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
and here is the usercontrol (no added code in the codebehind):
<UserControl x:Class="testproject.Controls.Test1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
Height="80" Width="80">
<Grid x:Name="LayoutRoot">
</Grid>
</UserControl>
Upvotes: 1
Views: 2637
Reputation: 115
Ok, I figured it out based on this post
http://forums.silverlight.net/post/618518.aspx
I cannot believe I added a space to my assembly name. ARG!
Upvotes: 1
Reputation: 5554
try:
<UserControl x:Class="testproject.Controls.Test1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Height="80" Width="80">
<Grid x:Name="LayoutRoot">
</Grid>
</UserControl>
Upvotes: 0