user1884032
user1884032

Reputation: 347

how to add textboxes at the end in datatemplate

I have a ListView which gives me correct information. I want to apped at the end of each row, two TextBoxes in which user can edit, can anyone guide me?

This is the result I want to see John Smith textbox textbox.

Here is my code below:

<ListView.ItemTemplate>
    <DataTemplate>
        <Label x:Name="lblPerson">
            <Label.Content>
                <TextBlock>
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0}   {1}">
                            <Binding Path="FName" />
                            <Binding Path="LName" />
                         </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </Label.Content>
        </Label>
    </DataTemplate>
</ListView.ItemTemplate>

Upvotes: 0

Views: 86

Answers (1)

Hannish
Hannish

Reputation: 1532

I don't know if I understand correctly what your problem is, but inside the DataTemplate you can use a StackPanel or a DockPanel and place the Label and anything else you can, something like this:

<ListView.ItemTemplate>
<DataTemplate>
 <StackPanel Orientation="Horizontal">
    <Label x:Name="lblPerson">
        <Label.Content>
            <TextBlock>
                <TextBlock.Text>
                    <MultiBinding StringFormat="{}{0}   {1}">
                        <Binding Path="FName" />
                        <Binding Path="LName" />
                     </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
        </Label.Content>
    </Label>
    <TextBox Text="Something">
    <TextBox Text="{Binding SomeField}">
  </StackPanel>
</DataTemplate>
</ListView.ItemTemplate>

Is this what you are asking? Regards

Upvotes: 1

Related Questions