I tried to use a <Frame/> control inside a <ViewBox/>.
Source of Frame Control is a page that lay in folder named Pages.
And in the page there is just one element. A Rectangle that is filled with XAML vector image.
Why this is not display anything?
<Window xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
x:Class="SearChForComp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Viewbox VerticalAlignment="Center" HorizontalAlignment="Center" >
<Frame Source="Pages/mainPage.xaml" NavigationUIVisibility="Hidden" />
</Viewbox>
</Grid>
And this is My Page (mainpage.xaml):
<Page x:Class="SearChForComp.Pages.mainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Title="mainPage">
<Grid>
<Rectangle Fill="{StaticResource intro2}" />
</Grid>
I defined my Resources in app.xaml like this:
<Application x:Class="SearChForComp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="VectorGrahics/intro2.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
And the Intro2.xaml is a large file. i post a first and last tags:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DrawingBrush x:Key="intro2" Stretch="Uniform">
<... \>
</DrawingBrush>
</ResourceDictionary>
It should work if you set the Width
/Height
, or atleast MinWidth
/MinHeight
of the Rectangle
in the Page
:
<Rectangle Fill="{StaticResource intro2}" MinWidth="1" MinHeight="1" />