locked
navigation to new page RRS feed

  • Question

  • Hi,

    I have a "login" opening page with a navigation to the main work page.  Everything seems to sort of work.  The problem is that when the main work page loads, it is squished to the bottom of the display and overlaid on top of the login page.  And the login page is still there - it should not be.

    Anyway, I think the core issue must be with the xaml code, but I am concerned with how the login page background image is applied.

    Below is the code, any advice would be greatly appreciated:

     

     

     

    //mainpage.xaml, starting from template:
    
    <UserControl x:Class="VCI_Envision_Portal.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"
        xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"    
        xmlns:navigationCore="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
     
        xmlns:local="clr-namespace:VCI_Envision_Portal"
       
         mc:Ignorable="d" 
         xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input">
    
    
    
        <UserControl.Resources>
           <local:ImageConverter x:Key="converter" />
        </UserControl.Resources>
    
        <Grid x:Name="LayoutRootlarge"  Background="#EEFFFF" >
            <!-- put the rest of your UI in another panel -->
            
            <Grid x:Name="LayoutRootImage" 
              Background="{ Binding WelcomeBackgroundImage,  Converter={StaticResource converter} }" 
              Height="400"
              Width="600" Opacity="0.5"/>
    
            <Grid x:Name="LayoutRootOverlap" Height ="400" Width="600" Opacity="1" >
    
                 <StackPanel Height="400" Width="600"> 
                    <HyperlinkButton x:Name="button1"
                                     Content="Login"                               
                                     Height="23" HorizontalAlignment="Left" 
                                     Margin="236,229,0,0" 
                                     VerticalAlignment="Top" Width="75" 
                                     Click="NavigateTo"
                                     Tag="/Views/MainWorkPage.xaml"
                                     TargetName="MainWorkPage"></HyperlinkButton>
                <navigation:Frame x:Name="MainWorkFrame" ></navigation:Frame>
                 </StackPanel>  
    
                <CheckBox Content="Remember my User ID on this machine" Height="16" HorizontalAlignment="Left" Margin="236,196,0,0" Name="RememberID_CB" VerticalAlignment="Top" />
                <dataInput:Label Height="24" HorizontalAlignment="Left" Margin="221,79,0,0" Name="label4" VerticalAlignment="Top" Width="140" Content="VCI Envision Portal" Foreground="#FF78B199" FontFamily="Lucida Sans Unicode" FontSize="14" />
                <dataInput:Label Content="User ID:" FontFamily="Lucida Sans Unicode" FontSize="14" Foreground="#FF78B199" Height="24" HorizontalAlignment="Left" Margin="105,129,0,0" Name="label1" VerticalAlignment="Top" Width="75" />
                <dataInput:Label Content="Password:" FontFamily="Lucida Sans Unicode" FontSize="14" Foreground="#FF78B199" Height="24" HorizontalAlignment="Left" Margin="93,165,0,0" Name="label2" VerticalAlignment="Top" Width="140" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="245,120,0,0" Name="UserIDTB" VerticalAlignment="Top" Width="120" />
                <TextBox Height="23" HorizontalAlignment="Left" Margin="245,165,0,0" Name="PasswordTB" VerticalAlignment="Top" Width="120" />
    
                <Image Height="77" HorizontalAlignment="Left" Margin="440,15,0,0" Name="SiteImageID" 
                       Stretch="Fill" VerticalAlignment="Top" Width="142"
                       Source= "{ Binding SiteImage}" >
                </Image>
                <Image Height="77" HorizontalAlignment="Left" Margin="20,15,0,0" Name="VCIImageID" 
                       Source="{Binding VCIImage}"
                       Stretch="Fill" VerticalAlignment="Top" Width="142" />
            </Grid>
        </Grid>
     
    </UserControl>
    
    
    // main work page xaml:
    <navigation:Page x:Class="VCI_Envision_Portal.MainWorkPage" 
               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"
               xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
               d:DesignWidth="640" 
               d:DesignHeight="480"
               x:Name="Main_Work_Page"
               Title="MainWorkPage"
    
        xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
               xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input">
        
        <Grid x:Name="LayoutRoot">
     
            <controls:TabControl Height="370" HorizontalAlignment="Left" Margin="0,48,0,0" Name="tabControl1" VerticalAlignment="Top" Width="142">
                <controls:TabItem Header="Display" Name="tabDisplay">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="178*" />
                            <ColumnDefinition Width="10*" />
                        </Grid.ColumnDefinitions>
                    </Grid>
                </controls:TabItem>
                <controls:TabItem Header="BAS" Name="tabBAS">
                    <Grid />
                </controls:TabItem>
     
            </controls:TabControl>
            <StackPanel Height="451" HorizontalAlignment="Left" Margin="172,29,0,0" Name="stackPanel1" VerticalAlignment="Top" Width="456">
                <StackPanel Height="27" Name="SiteInfoBar" Width="453" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Orientation="Horizontal" >
                    <dataInput:Label Content="Current Conditions" Height="20" Name="label1" Width="106" />
                    <dataInput:Label Content="Humidity:" Height="22" Name="label2" Width="57" />
                    <TextBox Height="23" Name="HumidityTB" Width="30" />
                    <dataInput:Label Content="Temperature:" Height="22" Name="label3" Width="83" />
                    <TextBox Height="23" Name="TemperatureTB" Width="30" />
                    <TextBox Height="23" Name="TimeTB" Width="133" />
                </StackPanel>
            </StackPanel>
        </Grid>
    </navigation:Page>
    
    
    // setting background in mainpage ( seems ok )
                Data d = new Data();
                using (MemoryStream ms = new MemoryStream(App.GlobalVariables.VCIconf.Image, 0,
                                              App.GlobalVariables.VCIconf.Image.Length))
                {
                    BitmapImage bi;
                    bi = new BitmapImage();
                   
                    bi.SetSource(ms);
                    d.WelcomeBackgroundImage = bi;
                    App.GlobalVariables.WelcomeBackgroundImage = bi;
    
                    this.DataContext = d; 
              }          
    
    


    Anything obvious?

     

     

     

    Monday, March 28, 2011 11:32 AM

Answers

  • Hi,

       When you navigate on main work page hide the login page component

    try this

    Mahesh

    Monday, April 11, 2011 1:31 AM