Forum Xamarin.Forms

How can I change the Detail Title section?

I have a Xamarin Forms application, and the only plaftorm it supports is UWP. I use Master-Detail architecture. I understand how I can change the Title text of the Detail page, but I need to change e.g. height of the Title pane and its background color. I guess it should be done on the MySolution.UWP project, but don't know how to approach this. I don't even know what I should change, TopCommandBarArea, or CommandBar, or LayoutRoot etc.

Here is some of my code from the shared project:

    private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        var item = e.SelectedItem as MainMDPageMenuItem;
        if (item == null)

        item.ItemBackgroundColor = Color.FromHex("#006c89");
        if (PreviouslySelectedItem != null)
            PreviouslySelectedItem.ItemBackgroundColor = Color.FromHex("#00a8d5");

        var page = (Page)Activator.CreateInstance(item.TargetType);
        page.Title = item.Title;

        Detail = new NavigationPage(page);
        IsPresented = false;

        MasterPage.ListView.SelectedItem = null;

        PreviouslySelectedItem = item;

Here is how it looks. The area in question has a red border around it:

Best Answer


  • jezhjezh Member, Xamarin Team Xamurai

    Besides, from the source code of Xamarin.Forms, you can find MasterDetailControlStyle.xaml,
    If you check this link, we will see the following code:

     <uwp:FormsCommandBar x:Name="CommandBar" Background="{TemplateBinding ToolbarBackground}" MinHeight=" 
     {ThemeResource TitleBarHeight}" HorizontalAlignment="Stretch">

    and we notice this property MinHeight=" {ThemeResource TitleBarHeight}"
    If you want to change the height of the Title pane, you could try to Customize your own MasterDetailControlStyle. but usually we don't recommend doing this. Because this can better adapt the device.

    Hope it can help you.

Sign In or Register to comment.