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이 앱의 변경 사항에 대해 분명히했으면 좋겠지 만 해결해 주어 기쁩니다. 감사 –