I'm sure this is a simple problem, but I've spent all day fighting it.
I'm trying to instantiate silverlight from a xaml file. I can create a grid, a canvas, text, etc, but whenever I try to add a Button, I get:
Silverlight error message
ErrorCode: 2007
ErrorType: ParserError
Message: Unknown element: Button.
XamlFile: myxaml.xaml
Line: 28
Position: 80
The xaml code is as follows:
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="Black" x:Name="root" Width="280" Height="330"
>
<Canvas Background="AliceBlue" Width="260" Height="310" Margin="10">
<TextBlock TextAlignment="Center" Width="260">Let's make a calculator!</TextBlock>
<TextBox Width="220" Grid.Column="2" Margin="20,20,10,10" TextAlignment="Right"></TextBox>
<Grid Width="220" Height="250" Background="green" Margin="20,50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="55" />
<ColumnDefinition Width="55" />
<ColumnDefinition Width="55" />
<ColumnDefinition Width="55" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<Button Content="1" Width="40" Height="40" Grid.Column="0" Grid.Row="0"></Button>
<Button Content="2" Width="40" Height="40" Grid.Column="1" Grid.Row="0"></Button>
<Button Content="3" Width="40" Height="40" Grid.Column="2" Grid.Row="0"></Button>
<Button Content="4" Width="40" Height="40" Grid.Column="0" Grid.Row="1"></Button>
<Button Content="5" Width="40" Height="40" Grid.Column="1" Grid.Row="1"></Button>
<Button Content="6" Width="40" Height="40" Grid.Column="2" Grid.Row="1"></Button>
<Button Content="7" Width="40" Height="40" Grid.Column="0" Grid.Row="2"></Button>
<Button Content="8" Width="40" Height="40" Grid.Column="1" Grid.Row="2"></Button>
<Button Content="9" Width="40" Height="40" Grid.Column="2" Grid.Row="2"></Button>
<Button Content="0" Width="40" Height="40" Grid.Column="0" Grid.Row="3"></Button>
<Button Content="+/-" Width="40" Height="40" Grid.Column="1" Grid.Row="3"></Button>
<Button Content="." Width="40" Height="40" Grid.Column="2" Grid.Row="3"></Button>
<!-- Calculator Functions -->
<Button Content="+" Width="40" Height="40" Grid.Column="3" Grid.Row="0"></Button>
<Button Content="-" Width="40" Height="40" Grid.Column="3" Grid.Row="1"></Button>
<Button Content="*" Width="40" Height="40" Grid.Column="3" Grid.Row="2"></Button>
<Button Content="/" Width="40" Height="40" Grid.Column="3" Grid.Row="3"></Button>
<Button Content="=" Width="95" Height="40" Grid.Column="2" Grid.Row="4" Grid.ColumnSpan="2"></Button>
</Grid>
</Canvas>
</Canvas>
if I do the same (well, changing the outer tags) in a VS2008 project, everything works fine, but I need to be able to do this using just a xaml file (and later some javascript). If I remove all Button elements, everything else works fine.
Any ideas? Any help would be greatly appreciated.
Richard