Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Header for ListView in MasterDetailSplitView

$
0
0

Hey guys,

I have a problem with the header/Navigationbar of the ListView, see the image below. I created a SplitView in Xamarin.Forms, but there is no Navigationbar over the SplitView on iOS (on Android it works fine). Can someone help me to create this in C#?

Here is my Master-Class:

`public class VisitorItemPage : ContentPage
{
public ListView listView;
private VisitorsItemDatabase _database;
private int selectedId;

    public VisitorItemPage (VisitorsItemDatabase database)
    {
        _database = database;

        Title = "Teilnehmer";

        var header = new Label {

            Text = "Text",
            Font = Font.SystemFontOfSize(20),

            HeightRequest = 40,
            XAlign = TextAlignment.Center

        };

        listView = new ListView {
            RowHeight = 40,
            ItemTemplate = new DataTemplate (typeof(VisitorItemCell))
        };

        var visitor = _database.GetVisitorItem ();
        listView.ItemsSource = visitor;

        listView.ItemSelected += (sender, e) => {
            if (e.SelectedItem == null) {
                return;
            }
            var visitorItem = (VisitorItem)e.SelectedItem;
            setSelectedId(visitorItem.ID);
            //DisplayAlert("Tapped", getSelectedId() + " Row was selected", "ok");
            var visitorDetailPage = new VisitorDetailPage (this, database);
            visitorDetailPage.BindingContext = visitorItem;
            ((ListView)sender).SelectedItem = null; 
            //Navigation.PushAsync (visitorDetailPage);
        };


        this.Content = new StackLayout {
            Children = {
                header,
                listView
            }
        };
    }

}`


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>