I have two xaml: MainWindow.xaml. After running program i have only window with text:"mainPage.xaml". There is no menu or jpg that i had setup in mainPage.xaml
MainWindow.xaml code:
<Window x:Class="FK.MainWindow"
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"
Title="A and I Version 0.1" Height="1080" Width="1920">
<Grid Background="LightGray">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>
<Frame x:Name="mainWindowMain"
Grid.Row="0">
</Frame>
</Grid>
MainWindow.xaml.cs code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FK
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
mainWindowMain.Content = new Uri("mainPage.xaml", UriKind.Relative);
}
}
}
mainPage.xaml code:
<Window x:Class="FK.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:local="clr-namespace:FK"
mc:Ignorable="d"
Title="mainPage" Height="450" Width="800">
<Grid Background="LightGray">
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Menu
x:Name="mainWindowMainMenu"
Grid.Row="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Height="20"
Width="auto"
>
<MenuItem Header="Menu" Height="20" Width="50">
<MenuItem x:Name="menuOpcjaFinances"
Header="Finances"
InputGestureText="Ctrl+F"
Height="20"
Width="200"
>
</MenuItem>
<MenuItem x:Name="menuOpcjaInvoices"
Header="Invoces"
InputGestureText="Ctrl+I"
Height="20"
Width="200">
</MenuItem>
<MenuItem x:Name="menuOpcjaPomoc"
InputGestureText="Ctrl+H"
Header="Help"
Height="20"
Width="200"
>
</MenuItem>
<MenuItem x:Name="menuOpcjaWyjscie"
InputGestureText="Ctrl+Q"
Header="Exit"
Height="20"
Width="200"
></MenuItem>
</MenuItem>
</Menu>
<Image Grid.Row="1"
Source="/mainPicture_.jpg"
VerticalAlignment="Stretch"
HorizontalAlignment="Center"></Image>
</Grid>
</Window>
When I had in MainWindow two gridrows, in first gridrow i had menu from mainPage.xaml, and in second grid i had frame, after clicking one of menu, other xaml loads without any problems into the frame.
I tried to setup two gridrows in MainWindow, i have tried to make public void with mainWindowMain.Content = new Uri("mainPage.xaml", UriKind.Relative); and insert the void in public MainWindow, but it does not help. I have no errors while compiling the program, i do not know where to search the problem