2016-07-14 10 views
0

Xamarim.FormsのDetailPageの上部に黒い線を削除する方法を教えてください。 サンプルのMasterDetail Pageを作成し、一番上に線をつけました。 どうすれば修正できますか?Xamarin.Form MasterDetailPage fix DetailPage location

DetailPageにパディング設定が見つかりませんでした。

screenshot 1

screenshot 2

RootPage.cs

public class RootPage : MasterDetailPage 
{ 
    private readonly string _content; 

    public RootPage(string content) 
    { 
     NavigationPage.SetHasNavigationBar(this, false); 
     //  _content = content; 
     var menuPage = new MenuPage(); 

     menuPage.Menu.ItemSelected += (sender, e) => NavigateTo(e.SelectedItem as MenuItem); 

     Master = menuPage; 

     Detail = new NavigationPage(new ContractsPage()); 
     // InitViews(); 
    } 

    void NavigateTo(MenuItem menu) 
    { 
     Page displayPage = (Page)Activator.CreateInstance(menu.TargetType); 

     Detail = new NavigationPage(displayPage); 

     IsPresented = false; 
    } 
} 

MenuPage.cs

public class MenuPage : ContentPage 
{ 
    public ListView Menu { get; set; } 

    public MenuPage() 
    { 
     Icon = "settings.png"; 
     Title = "menu"; // The Title property must be set. 
     BackgroundColor = Color.FromHex("333333"); 

     Menu = new MenuListView(); 

     var menuLabel = new ContentView 
     { 
      Padding = new Thickness(10, 36, 0, 5), 
      Content = new Label 
      { 
       TextColor = Color.FromHex("AAAAAA"), 
       Text = "MENU", 
      } 
     }; 

     var layout = new StackLayout 
     { 
      Spacing = 0, 
      VerticalOptions = LayoutOptions.FillAndExpand 
     }; 
     layout.Children.Add(menuLabel); 
     layout.Children.Add(Menu); 

     Content = layout; 
    } 



} 


public class MenuItem 
{ 
    public string Title { get; set; } 

    public string IconSource { get; set; } 

    public Type TargetType { get; set; } 
} 


public class MenuListView : ListView 
{ 
    public MenuListView() 
    { 
     List<MenuItem> data = new MenuListData(); 

     ItemsSource = data; 
     VerticalOptions = LayoutOptions.FillAndExpand; 
     BackgroundColor = Color.Green; 

     var cell = new DataTemplate(typeof(ImageCell)); 
     cell.SetBinding(TextCell.TextProperty, "Title"); 
     cell.SetBinding(ImageCell.ImageSourceProperty, "IconSource"); 

     ItemTemplate = cell; 
    } 
} 

public class MenuListData : List<MenuItem> 
{ 
    public MenuListData() 
    { 
     this.Add(new MenuItem() 
     { 
      Title = "Contracts", 
      IconSource = "contracts.png", 
      TargetType = typeof(ContractsPage) 
     }); 

     this.Add(new MenuItem() 
     { 
      Title = "Leads", 
      IconSource = "Lead.png", 
      TargetType = typeof(LeadsPage) 
     }); 

     this.Add(new MenuItem() 
     { 
      Title = "Accounts", 
      IconSource = "Accounts.png", 
      TargetType = typeof(AccountsPage) 
     }); 

     this.Add(new MenuItem() 
     { 
      Title = "Opportunities", 
      IconSource = "Opportunity.png", 
      TargetType = typeof(OpportunitiesPage) 
     }); 
    } 
} 



public class ContractsPage : ContentPage 
{ 
    public ContractsPage() 
    { 
     Title = "test"; 
     this.Padding=new Thickness(0,0,0,0); 
     NavigationPage.SetTitleIcon(this, "icon.png"); 

    } 
} 

public class LeadsPage : ContentPage 
{ 
    public LeadsPage() { } 
} 

public class AccountsPage : ContentPage 
{ 
    public AccountsPage() { } 
} 

public class OpportunitiesPage : ContentPage 
{ 
    public OpportunitiesPage() { } 
} 
+0

それが唯一のAndroid上で起こるん:

MainPage = new NavigationPage(new RootPage()); 

これを行いますか?他のプラットフォームを試してみましたか? – dylansturg

+0

Androidのみ。イオスは良いです。 – Atlantis

答えて

0

あなたは全角ですNavigationPageを別のものに寝かせます。あなたのpublic App()コンストラクタの代わりに

MainPage = new RootPage();