按钮中的图像在设计器中呈现,而不是 windows phone 模拟器(Windows 应用程序开发)
Image in button is rendering in the designer but not the windows phone emulator (Windows App Developement)
设计器加载图像作为按钮,但模拟器加载时没有图像。我可以推测这可能是一个 'image rendering beyond screen' 问题。对代码的任何建议将不胜感激。
设计器完全可见,两个图像划分屏幕(假设是按钮),而模拟器显示一半屏幕为黑色,其余部分为灰色,水平划分。
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=".5*"/>
<RowDefinition Height=".5*"/>
</Grid.RowDefinitions>
<Button
x:Name="CricketButton" Grid.Row="0"
Height="auto" Width="auto"
HorizontalAlignment="Stretch"
Margin="-5" VerticalAlignment="Stretch"
Click="CricketButton_Click"
FontSize="25" RequestedTheme="Light" Opacity="0.9" BorderThickness="0">
<Image Source="Assets\cricket-hd-wallpapers.jpg" Stretch="Fill" Opacity="0.7"/>
<!--<TextBlock Text="Cricket" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="White"
FontSize="72"/>-->
</Button>
<Button
x:Name="Football" Grid.Row="1"
HorizontalAlignment="Stretch"
Height="auto" Width="auto"
Margin="-5"
VerticalAlignment="Stretch"
Click="Football_Click"
FontSize="25"
RequestedTheme="Light" Opacity="0.9" Background="#FFC7C7C7" BorderThickness="0">
<Image Source="Assets\real-madrid-granada.jpg" Opacity="0.9" Stretch="Fill"/>
</Button>
</Grid>
可能无法在 运行 时间内解析文件位置。您需要确保在构建中包含图像。
http://www.wpfsharp.com/2012/01/23/using-relative-path-images-included-as-content-with-wpf/
设计器加载图像作为按钮,但模拟器加载时没有图像。我可以推测这可能是一个 'image rendering beyond screen' 问题。对代码的任何建议将不胜感激。
设计器完全可见,两个图像划分屏幕(假设是按钮),而模拟器显示一半屏幕为黑色,其余部分为灰色,水平划分。
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height=".5*"/>
<RowDefinition Height=".5*"/>
</Grid.RowDefinitions>
<Button
x:Name="CricketButton" Grid.Row="0"
Height="auto" Width="auto"
HorizontalAlignment="Stretch"
Margin="-5" VerticalAlignment="Stretch"
Click="CricketButton_Click"
FontSize="25" RequestedTheme="Light" Opacity="0.9" BorderThickness="0">
<Image Source="Assets\cricket-hd-wallpapers.jpg" Stretch="Fill" Opacity="0.7"/>
<!--<TextBlock Text="Cricket" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="White"
FontSize="72"/>-->
</Button>
<Button
x:Name="Football" Grid.Row="1"
HorizontalAlignment="Stretch"
Height="auto" Width="auto"
Margin="-5"
VerticalAlignment="Stretch"
Click="Football_Click"
FontSize="25"
RequestedTheme="Light" Opacity="0.9" Background="#FFC7C7C7" BorderThickness="0">
<Image Source="Assets\real-madrid-granada.jpg" Opacity="0.9" Stretch="Fill"/>
</Button>
</Grid>
可能无法在 运行 时间内解析文件位置。您需要确保在构建中包含图像。
http://www.wpfsharp.com/2012/01/23/using-relative-path-images-included-as-content-with-wpf/