Skip to content

Set length of a TabItem #845

Answered by Mithicor
KailangHuo asked this question in Q&A
Nov 27, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Using the DataTemplate has worked for me. Try setting the width of the Control that is set inside the DataTemplate. So in my example, I would set the Width of the TextBox.

<TabControl ItemsSource="{Binding ViewModel.UserAssignments}">
    <TabControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Margin="0,6" Width="100">
                <Run Text="{Binding AssignmentType}"/>
                <Run Text=" - "/>
                <Run Text="{Binding AssignmentList.Count, Mode=OneWay}"/>
            </TextBlock>
        </DataTemplate>
    </TabControl.ItemTemplate>

    <TabControl.ContentTemplate>
        <DataTemplate>
             //TAB CONTENT GOES HERE
        </DataTemplate>…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@KailangHuo
Comment options

Answer selected by KailangHuo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants