私はアプリケーションをテストするためのXamarinのサンプルフォーム "TableView"を使用していますが、廃止されたセクションImageSource = Device.OnPlatformはswitch文で置き換えられました。ここでは問題はありませんが、情報は豊富ですが、私には特有の問題があり、問題を見ることができません。Xamarin.Forms ImageSource = Device.OnPlatform廃止されました
私が追加しているコードは現在、以下のソースでコメントアウトされており、このようにして、もちろん画像なしでコンパイルされます。私がコメント欄を削除すると、35行目にエラーが表示されます}。 最後のブレークのすぐ下にある中括弧を強調表示すると、その一致、switch()が認識されます。その下にある中括弧を強調表示すると、それは上のPublic SearchPage()の一部であると考えられます。 スイッチの何かが問題を引き起こしていますが、私はそれを見ることができません。
私は、誰かがこの問題に遭遇し、回答を得たいと考えています。詳細が必要な場合はお知らせください。
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
//using static System.Net.Mime.MediaTypeNames;
namespace MiddleMeeter
{
class SearchPage : ContentPage
{
public SearchPage()
{
Label header = new Label
{
Text = "TableView for a form",
FontSize = 30,
FontAttributes = FontAttributes.Bold,
HorizontalOptions = LayoutOptions.Center
};
TableView tableView = new TableView
{
Intent = TableIntent.Form,
Root = new TableRoot("TableView Title")
{
new TableSection("Table Section")
{
new TextCell
{
Text = "Text Cell",
Detail = "With Detail Text",
},
new ImageCell
{
/**********************************************************************************************
switch (Device.RuntimePlatform)
{
case Device.iOS:
ImageSource.FromUri(new Uri("http://xamarin.com/images/index/ide-xamarin-studio.png"));
break;
case Device.Android:
ImageSource.FromFile("waterfront.jpg");
break;
case Device.WinPhone:
ImageSource.FromFile("Images/waterfront.jpg");
break;
default:
ImageSource.FromFile("Images/waterfront.jpg");
break;
},
*///////////////////////////////////////////////////////////////////////////////////////////////
Text = "Image Cell",
Detail = "With Detail Text",
},
new SwitchCell
{
Text = "Switch Cell"
},
new EntryCell
{
Label = "Entry Cell",
Placeholder = "Type text here"
},
new ViewCell
{
View = new Label
{
Text = "A View Cell can be anything you want!"
}
}
},
}
};
// Build the page.
this.Content = new StackLayout
{
Children =
{
header,
tableView
}
};
}
}
}
これはまさに必要なものです。私はXamarinが彼らのアプリの変化について明らかにしたいと思っていますが、これが解決してうれしいです。ありがとう –