コメント
コメントの投稿
※名前とタイトルが入力されていないコメントでは他のコメントとの区別ができません。
入力されていないコメントには返信しませんのであらかじめご了承くださいませ。
namespace AppName.Controls
{
public class BaseContentPage : ContentPage
{
public BaseContentPage() : base()
{
this.SizeChanged += this.OnSizeChanged;
}
private double width = 0;
private double height = 0;
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
if (this.width != width || this.height != height)
{
this.width = width;
this.height = height;
//ここに画面サイズが割り当てられた場合の処理内容を記載します。
}
}
protected void OnSizeChanged(object sender, EventArgs e)
{
//ここに画面サイズが変更になった場合の処理内容を記載します。
}
}
}
using AppName.Controls;
Using AppName.Services;
using Xamarin.Forms;
namespace Views
public class TestPage : BaseContentPage
{
//内容は省略
}
}
<?xml version="1.0" encoding="utf-8" ?>
<base:BaseContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:base="clr-namespace:AppName.Controls;assembly=AppName"
x:Class="AppName.Views.TestPage">
<base:BaseContentPage.Content>
<!--内容は省略-->
</base:BaseContentPage.Content>
</base:BaseContentPage>
※名前とタイトルが入力されていないコメントでは他のコメントとの区別ができません。
入力されていないコメントには返信しませんのであらかじめご了承くださいませ。