any help???

Jun 27, 2011 at 10:09 PM

hello

every time i try to change mainpage.xaml code

from this 

 

<UserControl x:Class="projectname.MainPage"
    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" d:DesignWidth="640" d:DesignHeight="480">
  <Grid x:Name="LayoutRoot">

  </Grid>
</UserControl>

to

<UserControl x:Class="namespace.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300" xmlns:game="clr-namespace:projectname">
    <Grid x:Name="LayoutRoot" Background="White">
        <Canvas>
            <game:Game1 x:Name="game"/>
        </Canvas>
    </Grid>
</UserControl>

it show's me this error 

Error 1 The name 'InitializeComponent' does not exist in the current context

how can i fix this???

and sorry for my bad english ,,

Jun 28, 2011 at 6:41 PM

I ran into an error like this earlier today, and it had to do with my Game's constructor being private rather than public.  I doubt that that would be your problem (since it's probably pretty unusual to make the Game's constuctor private), here are some of the things I suggest trying: 1) make sure that your class extending the XNA Framework's Game class is called Game1 (or change the name in your XAML file respectively), 2) make sure that the namespace at the top of your Game class is projectname (or change the name in your XAML file respectively)... actually... 3) try changing the x:Class back to it's original value(?).  Hope that helps.

Jun 28, 2011 at 9:48 PM

mmmmm still not working!

i need some tutorials!

or some simples,,,,

Coordinator
Jun 28, 2011 at 11:47 PM

Try this...

<UserControl x:Class="projectname.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300" xmlns:game="clr-namespace:projectname">
    <Grid x:Name="LayoutRoot" Background="White">
        <Canvas>
            <game:Game1 x:Name="game"/>
        </Canvas>
    </Grid>
</UserControl>

The problem was that you changed the x:Class and so it can't find your generated code behind file.

Jun 29, 2011 at 7:37 AM

its working now!!!

Thanks :D