KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Using WPF, I have a ListBox control with a DataTemplate inside it. The relevant XAML code is shown below: <ListBox Name="_todoList" Grid.Row="1" BorderThickness="2" Drop="todoList_Drop" AllowDrop="True" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" AlternationCount="2"> <ListBox.ItemTemplate> <DataTemplate> <Grid Margin="4"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <CheckBox Grid.Column="0" Checked="CheckBox_Check" /> <TextBlock Name="descriptionBlock" Grid.Column="1" Text="{Binding Description}" Cursor="Hand" FontSize="14" ToolTip="{Binding Description}" MouseDown="TextBlock_MouseDown" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> What I am trying to do is make the TextBlock respond to a (double)click which turns it into a TextBox . The user can then edit the description, and press return or change focus to make the change. I have tried adding a TextBox element in the same position as the TextBlock and making its visiblity Collapsed , but I don't know how to navigate to the right TextBox when the user has clicked on a TextBlock . That is, I know the user has clicked on a certain TextBlock , now which TextBox do I show? Any help would be appreciated greatly, -Ko9
Tags (comma-separated)
Save Edits
Cancel