急!Viewbox顯示不出東西[已解決]

cry****345 UID.2880314
2017-01-27 发表

本帖最后由 crycry12345 于 2017-1-29 23:19 编辑

我知道問題出在哪了,canvas要給他明確的width和height值,然後後台再根據需要修改值,感謝大家!

2017/1/29
---------------------------------------------------------------------------------------

最近在研究微軟人臉識別,用了一個Viewbox來等比例縮放,結果顯示不出東西,測試了一下發現Canvas放在Viewbox裡rectangle就無法顯示,
但是我需要把canvas放進viewbox,這樣才可以對rectangle進行縮放。請問是哪出問題了?我用的是VS2017RC

<Page
x:Class="ComputerVision.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ComputerVision"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid x:Name="root" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>

<Grid x:Name="pictureDisplay" Background="Black" Grid.Column="0">
<Viewbox Stretch="Uniform" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Canvas x:Name="canvas" Width="{x:Bind selectedImage.Width,Mode=OneWay}" Height="{x:Bind selectedImage.Height,Mode=OneWay}">
<Image x:Name="selectedImage" Source="/Assets/Square150x150Logo.scale-200.png" Stretch="Uniform"/>
</Canvas>
</Viewbox>
</Grid>

<Grid x:Name="textAndButton" Background="AliceBlue" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="9*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="resultText" Text="" TextWrapping="Wrap" FontSize="30" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="0"/>
<Button x:Name="pickButton" Content="Pick Picture" VerticalAlignment="Center" HorizontalContentAlignment="Center" Grid.Row="1" Click="pickButton_Click"/>
</Grid>
</Grid>
</Page>

敬告:
为防止不可控的内容风险,本站已关闭新用户注册,新贴的发表及评论;
你现在看到的内容只是互联网用户曾经发表的言论快照,仅用于老用户留存纪念,且仅与科技行业相关,全部内容不代表本站观点及立场;
本站重新开放前已针对包括用户隐私、版权保护、信息安全、国家政策在内的各种互联网法律法规要求,执行了隐患内容的自查、屏蔽和删除;
本站目前所属个人主体,未有任何盈利安排与计划,且与原WFUN.COM所属公司不存在任何关联关系;
如果本帖内容或者相关资源侵犯到您的合法权益,或者您认为存在问题,那么请您务必点此举报或投诉!
全部回复:
xiao****1996 UID.1108898
2017-01-27 使用 Lumia 640 XL 回复

太高端了。。。屁民表示顶贴。 这贴应该发到微软开发者社区

AFAN-World UID.2879093
2017-01-27 回复

呀……你……根本看不出结构体系。 发截图吧。

本站使用Golang构建,点击此处申请开源鄂ICP备18029942号-4联系站长投诉/举报