Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Custom TabItem - Controls not displayed in Visual Studio Designer

Tags:

I created a custom TabItem with a DockPanel and a Button in it.

XAML:

<TabItem
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      mc:Ignorable="d" x:Class="MovieDB.UI.UserControlls.SearchTab" d:DesignWidth="500.038" d:DesignHeight="309.055">

    <DockPanel Background="#FFE5E5E5">
        <Button x:Name="button" Content="Button" Height="100" Width="75" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </DockPanel>
</TabItem>

C#:

namespace MovieDB.UI.UserControlls
{
    /// <summary>
    /// Interaktionslogik für SearchTab.xaml
    /// </summary>
    public partial class SearchTab : TabItem
    {
        private SearchContainer<SearchMovie> results;

        public SearchTab()
        {
            InitializeComponent();
            this.Header = "Suche";
        }

        public SearchTab(SearchContainer<SearchMovie> results):this()
        {
            this.updateSearch(results);
        }

        public void updateSearch(SearchContainer<SearchMovie> results)
        {
            clear();
            if(results.TotalResults == 0)
            {

            }
            else
            {
                this.results = results;
                Debug.WriteLine("Results: " + results.Results.Count());
            }
        }

        private void clear()
        {

        }
    }
}

If launch my program the button is displayed (Screenshot 2). But the button and i guess the panel itselve does noch show up in the Visual Studio 2015 Designer (Screenshot 1).

Where is the Problem?

Screenshot Designer Screenshot running Programm