windows-phone-7user-controlspanorama-control

WP7 Usercontrol cannot be referred in MainPage.xaml


This is how my MainPage looks like:

<phone:PhoneApplicationPage 
x:Class="EnergyRadio.MainPage"
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:local="clr-namespace:EnergyRadio"
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800" 
d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait"  Orientation="Portrait"
shell:SystemTray.IsVisible="False">

<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">

    <!--Panoramasteuerelement-->
    <controls:Panorama Title="Radio">
        <controls:Panorama.Background>
            <ImageBrush ImageSource="PanoramaBackground.png"/>
        </controls:Panorama.Background>

        <!--Panoramaelement one-->
        <controls:PanoramaItem Header="CHANNELS">
             <!--First Panaroma Items HARD CODED-->
        </controls:PanoramaItem>

        <controls:PanoramaItem Header="KONTAKT">
            <!--Kontakt.xaml should be shown here.-->
        </controls:PanoramaItem>
    </controls:Panorama>
</Grid>

And this is my Kontakt.xaml

<UserControl x:Class="EnergyRadio.Kontakt"
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:local="clr-namespace:EnergyRadio"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="480" d:DesignWidth="480">

<Grid x:Name="LayoutRoot">
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Image  HorizontalAlignment="Left" Margin="624,153,0,0" Name="wemf" Stretch="Fill" VerticalAlignment="Top" Width="1" Height="0" />
        <TextBox Height="72" Margin="0,0,0,0" Name="kontakt_name" Text="Name" VerticalAlignment="Top" GotFocus="kontakt_name_GotFocus" />
        <TextBox Height="72" Margin="0,72,0,0" Name="kontakt_email" Text="Email" VerticalAlignment="Top" GotFocus="kontakt_email_GotFocus" />
        <TextBox Height="72" Margin="0,144,0,0" Name="kontakt_telefon" Text="Telefon" VerticalAlignment="Top" GotFocus="kontakt_telefon_GotFocus" />
        <TextBox Height="196" Margin="0,216,0,0" Name="kontakt_nachricht" Text="Nachricht" VerticalAlignment="Top" GotFocus="kontakt_nachricht_GotFocus" />
        <Button Content="Absenden" Height="72" HorizontalAlignment="Left" Margin="6,408,0,0" Name="buttonsend" VerticalAlignment="Top" Width="438" Click="buttonsend_Click" />
    </Grid>
</Grid>

The Grid in Kontakt.xaml must be shown in Mainpage.xaml. But i can't refere to it.

Does anybody know how to do this? And I have to do this in a Usercontrol, because i want to use it in other Panoramas too.


Solution

  • <local:Kontakt /> I think...