Editing items in a bound ListBox?
-
Hi, I am facing the similar kind of issue. But I am actually changing the controTemplate of ListBoxItem itself with ContentPresenter & a TextBox. Did the same thing as per the posted contents but it did not work with the binded list. I have given something like below in the ControlTemplate of ListBox Item. ; Kindly suggest.
-
Hi, I am facing the similar kind of issue. But I am actually changing the controTemplate of ListBoxItem itself with ContentPresenter & a TextBox. Did the same thing as per the posted contents but it did not work with the binded list. I have given something like below in the ControlTemplate of ListBox Item. ; Kindly suggest.
-
Hi, I am facing the similar kind of issue. But I am actually changing the controTemplate of ListBoxItem itself with ContentPresenter & a TextBox. I did the same thing as per the posted contents but it did not work with the binded list. I have given something like below in the ControlTemplate of ListBox Item. <ContentPresenter x:Name="displayTextBlock" Grid.Column="0" Grid.ColumnSpan="1" Margin="11,5,11,5" HorizontalAlignment="Stretch"/> <TextBox x:Name="listItemTextBox" Padding="11,5,11,5" HorizontalAlignment="Stretch" Background="Transparent" Grid.Column="0" Visibility="Collapsed" Grid.ColumnSpan="1" Text="{Binding Path=Content, ElementName=displayTextBlock, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" /> Kindly suggest. Thnx, Ritesh
-
See if it appears perfectly now.. Hi, I am facing the similar kind of issue. But I am actually changing the controTemplate of ListBoxItem itself with ContentPresenter & a TextBox. I did the same thing as per the posted contents but it did not work with the binded list. I have given something like below in the ControlTemplate of ListBox Item. <ContentPresenter x:Name="displayTextBlock" Grid.Column="0" Grid.ColumnSpan="1" Margin="11,5,11,5" HorizontalAlignment="Stretch"/> <TextBox x:Name="listItemTextBox" Padding="11,5,11,5" HorizontalAlignment="Stretch" Background="Transparent" Grid.Column="0" Visibility="Collapsed" Grid.ColumnSpan="1" Text="{Binding Path=Content, ElementName=displayTextBlock, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" /> Kindly suggest. Thnx, Ritesh
-
Actually TextBox will be hidden & will be visible on DoubleClick. At that time, I want the content of ListBox item to be modified in Textbox & after lostfocus of TextBox, it should update ListBox Item & again becomes hidden. This works for unbound list but for bound list, I need your suggestions.
-
See if it appears perfectly now.. Hi, I am facing the similar kind of issue. But I am actually changing the controTemplate of ListBoxItem itself with ContentPresenter & a TextBox. I did the same thing as per the posted contents but it did not work with the binded list. I have given something like below in the ControlTemplate of ListBox Item. <ContentPresenter x:Name="displayTextBlock" Grid.Column="0" Grid.ColumnSpan="1" Margin="11,5,11,5" HorizontalAlignment="Stretch"/> <TextBox x:Name="listItemTextBox" Padding="11,5,11,5" HorizontalAlignment="Stretch" Background="Transparent" Grid.Column="0" Visibility="Collapsed" Grid.ColumnSpan="1" Text="{Binding Path=Content, ElementName=displayTextBlock, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" /> Kindly suggest. Thnx, Ritesh
-
It won't work because you are binding the TextBox to the ContentPresenter. There is no binding to your data element at all.
This is a custom control. In window, ItemSource of this control is bind to a collection Object. Do you suggest some other approach for this.
-
Actually TextBox will be hidden & will be visible on DoubleClick. At that time, I want the content of ListBox item to be modified in Textbox & after lostfocus of TextBox, it should update ListBox Item & again becomes hidden. This works for unbound list but for bound list, I need your suggestions.
-
This is a custom control. In window, ItemSource of this control is bind to a collection Object. Do you suggest some other approach for this.
-
But you have not bound any property of the collection to the ListBox item. How do you expect the collection to change?
Hi, We are doing the binding as below: <eclp:EclpList Name="eclpList" Margin="5" Height="Auto" Width="100" ItemsSource="{Binding}" DisplayMemberPath="Name" SelectionChanged="cmb_SelectionChanged" /> See if this can give any ideas.. Thnx Ritesh