1
我想知道如何使項目分開,而不是非常接近對方。現在,iOS上的每個項目都太靠近了。 我嘗試在ListView和StackLayout上設置邊距和空間,但每個項目之間的空間沒有改變。爲了增加空間,我發現我需要對圖像單元做些什麼。圖像單元是從文本單元繼承的,但沒有屬性設置邊距或空間。有誰知道如何操作?如何在MasterDetail頁面上的項目之間添加空格?
public MasterPageCS()
{
var masterPageItems = new List<MasterPageItem>();
masterPageItems.Add (new MasterPageItem {
Title = "Contacts",
IconSource = "contacts.png",
TargetType = typeof(ContactsPageCS)
});
masterPageItems.Add (new MasterPageItem {
Title = "TodoList",
IconSource = "todo.png",
TargetType = typeof(TodoListPageCS)
});
masterPageItems.Add (new MasterPageItem {
Title = "Reminders",
IconSource = "reminders.png",
TargetType = typeof(ReminderPageCS)
});
listView = new ListView {
ItemsSource = masterPageItems,
ItemTemplate = new DataTemplate (() => {
var imageCell = new ImageCell(); //This one!!!!
imageCell.SetBinding (TextCell.TextProperty, "Title");
imageCell.SetBinding (ImageCell.ImageSourceProperty, "IconSource");
return imageCell;
}),
VerticalOptions = LayoutOptions.FillAndExpand,
SeparatorVisibility = SeparatorVisibility.None
};
Padding = new Thickness (0, 40, 0, 0);
Icon = "hamburger.png";
Title = "Personal Organiser";
Content = new StackLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
Children = {
listView
}
};
}