我是.NET毛伊岛的新手,我有一个简单的问题:
如何将布局中的所有剩余空间用于GraphicsView?
我试了HorizontalOptions="Fill"
和VerticalOptions="Fill"
的组合.但只有在我将GraphicsView直接插入到Content Page中时,它才能起作用.
一旦我使用布局将GraphicsView放入其中,它就不会出现.要显示这一点,唯一的方法是使用具体数字的高度和宽度要求.
为什么我的try 不起作用,我如何解决这个问题?
这不起作用:
<ContentPage>
<ContentPage.Resources>
<drawable:MyDrawable x:Key="drawable" />
</ContentPage.Resources>
<VerticalStackLayout>
<GraphicsView Drawable="{StaticResource drawable}"
BackgroundColor="Purple"
HorizontalOptions="Fill"
VerticalOptions="Fill"/>
<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>
这是可行的,但大小是固定的:
<ContentPage>
<ContentPage.Resources>
<drawable:MyDrawable x:Key="drawable" />
</ContentPage.Resources>
<VerticalStackLayout>
<GraphicsView Drawable="{StaticResource drawable}"
BackgroundColor="Purple"
HeightRequest="200"
WidthRequest="200" />/>
<Label
Text="Hello, World!"
SemanticProperties.HeadingLevel="Level1"
FontSize="32"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentPage>