i
Menu = new MenuListView();
Menu.RowHeight = 44;
Menu.SeparatorColor = Color.FromHex ("e8e8e8");
Menu.SeparatorVisibility = SeparatorVisibility.Default;
menuListView ve DataClass aşağıdaki gibidir
namespace LoginNavigation
{
public class MenuListView : ListView
{
public MenuListView()
{
List<MenuItemForMaster> data = new MenuListData();
ItemsSource = data;
VerticalOptions = LayoutOptions.FillAndExpand;
BackgroundColor = Color.Accent;
var cell = new DataTemplate (typeof(MenuCell));
//cell.SetBinding (MenuCell.TextProperty, "Title");
//cell.SetBinding (MenuCell.ImageSourceProperty, "IconSource");
this.HasUnevenRows = false;
ItemTemplate = cell;
}
namespace LoginNavigation
{
public class MenuListData : List<MenuItemForMaster>
{
public MenuListData()
{
this.Add (new MenuItemForMaster() {
Name = “"
ImageSource = "paper_plane.png",
TargetType = typeof(TimeSheet)
});
this.Add (new MenuItemForMaster() {
Name = "Extn : 3969",
ImageSource = "phone_reciever.png",
TargetType = typeof(TimeSheet)
});
this.Add (new MenuItemForMaster() {
Name = "TimeSheet",
ImageSource = "Calender.png",
TargetType = typeof(TimeSheet)
});
this.Add (new MenuItemForMaster() {
Name = "Omega",
ImageSource = "Notes.png",
TargetType = typeof(Omega)
});
}
}
}
var, kod size MenuPage içinde
namespace LoginNavigation
{
public class RootPage:MasterDetailPage
{
MenuPage menuPage;
public RootPage()
{
menuPage = new MenuPage();
menuPage.Menu.ItemSelected += (sender, e) => NavigateTo (e.SelectedItem as MenuItemForMaster);
Master = menuPage;
Detail = new NavigationPage (new TimeSheet()){
};
}
void NavigateTo (MenuItemForMaster menu)
{
if (menu == null)
return;
Page displayPage = (Page)Activator.CreateInstance (menu.TargetType);
//Detail = displayPage;
Detail = new NavigationPage (displayPage) { BarBackgroundColor = Color.FromHex("008dce"),BackgroundColor = Color.FromHex("008dce")};
menuPage.Menu.SelectedItem = null;
IsPresented = false;
}
}
}
yardımcı aşağıda bana bildirin
nihayet bu eğer çalışırsa yarın test edecek, benim bilgisayardan şu anda uzaktayım MenuItemForMaster
namespace LoginNavigation
{
public class MenuItemForMaster
{
public string Name { get; set; }
public string ImageSource { get; set; }
public Type TargetType { get; set; }
}
olduğunu! – medvedo