に一致するようにマイクロソフトUWPアプリ - ...これはおそらく、単純ですが、私は(UWPへのnoobを)それを把握するカント背景画像
をウィンドウのサイズを設定し、私は私が私の背景として使用したい画像を持っていますアプリ(それは本当にデスクトップのためだけです - 私は携帯電話などについて心配していません)。
私はちょうどウィンドウのサイズを設定して、アプリケーションが特定のサイズで開始し、画像が拡大縮小せずにその中に入るようにしたいだけです。
意味がありますか?
簡単であるべき - 私はWindowsフォームでそれを行っているし、そのはかなりまっすぐ進む...
は、私は(画像と同じサイズ)ウィンドウのサイズを設定しようとしている:
ApplicationView.PreferredLaunchViewSize = new Size(Height = 800, Width = 525);
しかし、画像は、画像のプロパティやグリッドのサイズなど、調整する設定に関係なく、正しく表示されることはありません。それはすべてが(私に)OKに見えるXAMLデザインビューで
:
しかし、あなたはアプリのない実行します。要求に応じて
XAMLコード:
<Page
x:Class="UWP_Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:UWP_Test"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<Image Source="Assets/titlescreen.bmp" Opacity="0.5" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
</Grid>
</Page>
XAML.CS cod e
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace UWP_Test
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
// Set the app window preferred launch view size
ApplicationView.PreferredLaunchViewSize = new Size(Height = 800, Width = 525);
// Set app window preferred launch windowing mode
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
}
private void button_Click(object sender, RoutedEventArgs e)
{
// move to Start page
this.Frame.Navigate(typeof(Start));
}
}
}
私は確信しています。
私はなぜUniformToFillのに設定ストレッチプロパティを使用していない、それは完全に動作しませんがあなたは私の唯一の希望...
を解決し、あなたがそれ以上の任意の他のコントロールしています(たとえば、グリッドまたはそのようなものとしては?)いくつかのコントロールが –
それより上のスペースを占有しているが、あなたが追加してもらえますように見えますあなたの質問にXAMLコード? – Herdo
@BarneyChambers - 上記の他のコントロールはありません。要求されたXAMLコードを参照してください。 – pelagos