0
    <TabControl HorizontalAlignment="Stretch" TabStripPlacement="Left" Margin="10,20,0,0"  Name="tabControl2" ItemsSource="{Binding NotesObs}" VerticalAlignment="Stretch" MinHeight="80">
        <TabItem Header="Contract Read and understood, proposal letter read and understood." Name="tabItem2" FontSize="14" IsEnabled="True">
            <Grid>
                <Border Name="b_desc"/>
                <TextBox HorizontalAlignment="Stretch" Margin="0"  Name="textBox5" Text="{Binding ContractText}"

                                         VerticalAlignment="Stretch" FontSize="12" TextWrapping="Wrap" 
                                         AutoWordSelection="True" VerticalScrollBarVisibility="Auto" 
                                         AcceptsReturn="True" 
                                         Width="{Binding ElementName=b_desc, Path=ActualWidth}" 
                                         Height="{Binding ElementName=b_desc, Path=ActualHeight}" 
                                         MaxWidth="{Binding ElementName=b_desc, Path=Width}" 
                                         MaxHeight="{Binding ElementName=b_desc, Path=Height}" />
            </Grid>
        </TabItem>
    </TabControl>

Above is my Xaml and the name of my ObsCollection is

public ObservableCollection<NotesDisplay> NotesObs { get; set; }

I have declared properly the ContractText column in the NotesDisplay Model. I cant get this to bind for some reason but this works in a datagrid. Can someone explain what I am doing wrong in my XAML?

Thanks

Edit: I have viewed the linked solution but tabs arent showing up when I run the program. They do showup in the display in xaml

<UserControl x:Class="CAT_Application_WPF.UI.NotesPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:CAT_Application_WPF.UI"
             xmlns:viewModel="clr-namespace:CAT_Application_WPF.ViewModel"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             mc:Ignorable="d" 
             xmlns:oxy="http://oxyplot.org/wpf"
             d:DesignHeight="640">

    <Grid Margin="0,0,0,0" Background="{DynamicResource {x:Static SystemColors.GradientActiveCaptionBrushKey}}" d:DataContext="{d:DesignInstance viewModel:NotesPageViewModel}" >

        <Grid.RowDefinitions>
            <RowDefinition Height="60*"></RowDefinition>

        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="300"></ColumnDefinition>
            <ColumnDefinition Width="400"></ColumnDefinition>

        </Grid.ColumnDefinitions>

        <TabControl HorizontalAlignment="Stretch" ItemsSource="{Binding NotesObs}" TabStripPlacement="Top"   x:Name="_tabControl"  VerticalAlignment="Stretch" MinHeight="80" Grid.ColumnSpan="2" Margin="121,28,279,-28">
            <TabControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock>                            
                <TextBlock Text="{Binding ContractText}"/> 
            </TextBlock>
                </DataTemplate>
            </TabControl.ItemTemplate>
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <TextBlock>                            
                This is <TextBlock Text="{Binding EMSText}"/>
            </TextBlock>
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
    </Grid>
</UserControl>
ViVi
  • 4,339
  • 8
  • 29
  • 52
bossman1111
  • 85
  • 1
  • 9

1 Answers1

0

Now it's quite ok but you must remove your TextBlock inside another TextBlock stuff.

You can change

<TextBlock>                            
  <TextBlock Text="{Binding ContractText}"/> 
</TextBlock>

to

<TextBlock Text="{Binding ContractText}"/> 

And

<TextBlock>                            
  This is <TextBlock Text="{Binding EMSText}"/>
</TextBlock>

to something similar to

<StackPanel Orientation="Horizontal">
  <TextBlock>This is</TextBlock>
  <TextBlock Text="{Binding EMSText}"/>
</StackPanel>
Giangregorio
  • 1,482
  • 2
  • 11
  • 12