How do you replace an entire xaml element?

Posted by luke on Stack Overflow See other posts from Stack Overflow or by luke
Published on 2010-03-20T18:46:49Z Indexed on 2010/03/20 18:51 UTC
Read the original article Hit count: 295

Filed under:
|
|
<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?

© Stack Overflow or respective owner

Related posts about xaml

Related posts about wpf