Skip to content

Set length of a TabItem #845

Answered by Mithicor
KailangHuo asked this question in Q&A
Nov 27, 2023 · 1 comments · 5 replies
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 5 replies

Comment options

You must be logged in to vote
5 replies
@KailangHuo
Comment options

@APerricone
Comment options

@saeelg-sg
Comment options

@saeelg-sg
Comment options

@APerricone
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
4 participants