필자는 요구 사항 목록을 가지고 있으며 각 요구 사항에는 JSON에서 추출한 속성이 있으며 잠시 JSON의 typeName 및 requisiteStatusId 속성에만 관심이 있다고 생각합니다. 이 두 가지는 해당 요구 사항 유형 (시험, 기사 읽기 등) 및 현재 상태에 해당하는 이미지의 속성입니다. ,내 listview에 사진을 표시하려면 어떻게해야합니까?
나는 이미 목록보기 내부 이미지를 표시 할 수 있습니다하지만 난 당신이 해당 이미지를 표시해야 할 두 가지에 의존 예를
{
"id": 1221,
"name": "Visibility - Public Acknowledgement",
"description": "Acknowledgement from Omar during a Q Meeting",
"typeId": 11,
**"typeName": "Proven XP",**
"validationId": null,
"skillId": 131,
"skillName": "Visibility",
"material": "No Material",
"materialUrl": "#",
**"requisiteStatusId": 4,**
"trailName": "General Knowledge",
"trailId": 5,
"levelId": 1
},
를 들어, 유형 이름과 requisiteStatusId에 해당하는 이미지를 표시해야 세 개의 주와 10 종류의 예를 들어, 지금은이 방법으로 직접 이미지를 보여주는거야 들어있다 : 나는 JSON에서 속성을 추출하거나하는 방법의 유효성을 검사하는 방법을 모르는
public class CustomVeggieCell : ViewCell
{
public CustomVeggieCell()
{
var image = new Image
{
};
var image2 = new Image
{
};
var nameLabel = new Label
{
VerticalTextAlignment = TextAlignment.Center,
TextColor = Color.FromHex("#FF9E9E9E"),
};
var horizontalLayout = new StackLayout()
{
};
//set bindings
nameLabel.SetBinding(Label.TextProperty, "Name", BindingMode.TwoWay);
image.Source = "book.png";
image2.Source = "Palomitashida.png";
//Set properties for desired design
horizontalLayout.Orientation = StackOrientation.Horizontal;
image2.HorizontalOptions = LayoutOptions.EndAndExpand;
nameLabel.HorizontalOptions = LayoutOptions.StartAndExpand;
nameLabel.VerticalOptions = LayoutOptions.Center;
nameLabel.TextColor = Color.FromHex("#FF9E9E9E");
//add views to the view hierarchy
horizontalLayout.Children.Add(image);
horizontalLayout.Children.Add(nameLabel);
horizontalLayout.Children.Add(image2);
View = horizontalLayout;
}
}
이 Nuget에서 here에서 컨텍스트 enter image description here
그래서 JSON 또는 ListView.SmallImageList 및 LargeImageList에서 값을 추출하고 싶습니까? –
@MohitShrivastava 속성에 따라 쇼 이미지가 필요하기 때문에 "typeName"및 "requisiteStatusId"를 추출하고 싶습니다. 이제는 json에 종속 된 이미지를 표시하는 방법을 알고 있어야합니다. –