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 928563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:01:56+00:00 2026-05-15T20:01:56+00:00

<ListView> <ListView.Resources> <DataTempalte x:Key=label> <TextBlock Text={Binding Label}/> </DataTEmplate> <DataTemplate x:Key=editor> <UserControl Content={Binding Control.content}/> <!–

  • 0
<ListView>
    <ListView.Resources>
        <DataTempalte x:Key="label">
            <TextBlock Text="{Binding Label}"/>
        </DataTEmplate>
        <DataTemplate x:Key="editor">
            <UserControl Content="{Binding Control.content}"/> <!-- This is the line -->
        </DataTemplate>
    </ListView.Resources>
    <ListView.View>
        <GridView>
            <GridViewColumn Header="Name"  CellTemplate="{StaticResource label}"/>
            <GridViewColumn Header="Value" CellTemplate="{StaticResource editor}"/>
        </GridView>
    </ListView.View>

On the marketed line, I’m replacing the contents of a UserControl with the contents of another UserControl that is dynamically created in code. I’d like to replace the entire control, and not just the content. Is there a way to do this?

Edit:

To clarify my intent, the Items that my ListView collection holds owns a Control (which inherits from UserControl) that knows how to manipulate the item’s value. Simply binding the Content gets me the visual representation, but discards other non-content related properties of the derived Control. If I could replace that UserControl in my template in a more whole-sale fashion, this would fix that problem.

  • 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-15T20:01:56+00:00Added an answer on May 15, 2026 at 8:01 pm

    I finally figured this one out:

        <DataTemplate x:Key="editor">
            <ContentPresenter Content="{Binding Path=Control}"/>
        </DataTemplate>
    

    The ContentPresenter is exactly what I was looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm binding a list to a ListView using a DataTemplate: <UserControl.Resources> <DataTemplate x:Key=eventsListItemTemplate> <StackPanel
I am using a ListView with an ItemTemplate like this: <Window.Resources> <DataTemplate x:Key=ItemTemplate> <WrapPanel
Here is the problem: I have a ListView as following: <UserControl.Resources> <DataTemplate x:Key="FirstCell"> <StackPanel
the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
the XAML of my window: <ListView Grid.Row=0 Name=files> <ListView.Resources> <DataTemplate x:Key=CheckboxTemplate> <CheckBox IsChecked={Binding Save,
<ListView ItemsSource={Binding MyData}> <ListView.View> <GridView> <GridViewColumn Header=col1 DisplayMemberBinding={Binding Path=value1}> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock TextAlignment=Right Text={Binding
<ListView Margin=0 Background=White ItemContainerStyle={DynamicResource ListViewItemStyle} ItemTemplate={DynamicResource DataTemplate}> <ListView.Resources> <Style x:Key=ListViewItemStyle TargetType={x:Type ListViewItem}> <Setter Property=Template>
Ok, I completed the tutoriel at this site, http://developer.android.com/resources/tutorials/views/hello-listview.html My problem is that I
A ListView with Datatemplate in GridViewColumn: <ListView Name =LogDataList IsSynchronizedWithCurrentItem=True ItemsSource={Binding LogDataCollection} Background=Cyan> <ListView.View>
This is defined in App.xaml inside <Application.Resources> : <Style x:Key=borderStyle TargetType=Border> <Style.Triggers> <Trigger Property=IsMouseOver

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.