Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 489385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:48:10+00:00 2026-05-13T01:48:10+00:00

I have the following DataTemplate: <DataTemplate DataType={x:Type Client:WorkItem}> <Grid> <Grid.RowDefinitions> <RowDefinition Height=Auto /> <RowDefinition

  • 0

I have the following DataTemplate:

<DataTemplate DataType="{x:Type Client:WorkItem}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="200" />
        </Grid.ColumnDefinitions>
        <Label Name="lblIDText" Margin="2">WI ID:</Label>
        <Label Name="lblID" Margin="2" Grid.Column="1" 
               Target="{Binding Id}"></Label>

        <Label Name="lblTitleText" Grid.Row="1" Margin="2">WI Title:</Label>
        <Label Name="lblTitle" Margin="2" Grid.Row="2" Grid.ColumnSpan="2" 
               Target="{Binding Title}"></Label>

    </Grid>
</DataTemplate>

in my <Window.Resources> section. It is meant to show the Id and Title of a WorkItem object (from namespace Microsoft.TeamFoundation.WorkItemTracking.Client.)

I try to put this in a TabItem in a TabControl and it only shows the static text. (The WorkItem ID and title do not show, but the static text in my template does.)

Clearly the template is being fired, but the binding is not working and I can’t seem to see why.

Here is my C# that calls it:

    private void PickWorkItem_Click(object sender, RoutedEventArgs e)
    {
        int Id = int.Parse(((Button) e.OriginalSource).Tag.ToString());

        _mediator.PickedWorkItem = GetWorkItemInQueryResultListByID(Id);
        tabAddLinks.DataContext = _mediator.PickedWorkItem;
        tabAddLinks.Content = _mediator.PickedWorkItem;

    }        

I tried it with DataContext in and out and it works the same. When I debug, the value for _mediator.PickedWorkItem is set correctly (Id and Title are both fine).

Any ideas on how to fix this would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:48:10+00:00Added an answer on May 13, 2026 at 1:48 am

    You’re binding the Label‘s Target property, when you actually want to be binding it’s Content property:

    <Label Content="{Binding Id}"/>
    

    Also, consider using a TextBlock instead of a Label if you don’t need the extra functionality a Label provides:

    <TextBlock Text="{Binding Id}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say i have the following DataTemplate: <DataTemplate x:Key=ListBoxItemTemplate> <Grid HorizontalAlignment=Stretch Width=440> <Grid.ColumnDefinitions> <ColumnDefinition
I have the following XAML: <Grid x:Name=root> <Grid.RowDefinitions> <RowDefinition Height=*/> <RowDefinition Height=Auto/> </Grid.RowDefinitions> <Grid.Resources>
I have the following AutoCompleteBox defined inside DataTemplate: <Window.Resources> <DataTemplate x:key=PaneTitleTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition
I have the following code currently: <DataTemplate DataType={x:Type vm:SectionViewModel}> <ScrollViewer> <ItemsControl ItemsSource={Binding ViewModels}> </ItemsControl>
So I have the following DataTemplate for a ListBox.ItemTemplate : <DataTemplate x:Key=Tweet> <Grid> <Grid.ColumnDefinitions>
I have the following xaml code in resources: <DataTemplate DataType={x:Type s:Substance}> <StackPanel Orientation=Horizontal> <TextBlock
I have the following Data Template applied to a ListBox: <DataTemplate x:Key=MyTemplate DataType={x:Type DAL:Person}>
I have the following datatemplates: First One: <DataTemplate DataType={x:Type WIAssistant:DestinationField}> <ContentControl Margin=5 MinWidth=60 MinHeight=70
I have a ListBox showing items using the following DataTemplate: <DataTemplate x:Key=PersonTemplate DataType={x:Type DAL:ResultItem}
I have the following scenario in XAML: <Grid Grid.IsSharedSizeScope=True> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.