Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

ComboBoxItem with delete button not deleting an Item

$
0
0

Hi,

I have a ComboBox, If I add a Item in a Combobox,It should get added in a Combobox as comboboxItem.

As Item I am providing a Template as Textblock and a Delete Button,by clicking on Delete button in ComboboxItems,It should delete

mouse Hover item.How I do Deleting part?

Regards,

Rosy D

<ComboBox Name="cmb" Margin="0,0,0,0" Grid.Row="0" Grid.Column="0"  HorizontalAlignment="Left" Height="20" 
                               SelectedItem="{Binding SelectedLangItem,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                IsSynchronizedWithCurrentItem="True" 
                                IsEditable="True" VerticalAlignment="Top" Width="{Binding Path=Width.AdjustedValue, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"  
                                ItemsSource="{Binding Path=FreeTextList,Mode=OneWay,NotifyOnSourceUpdated=True}"  ><ComboBox.ItemTemplate><DataTemplate><StackPanel Orientation="Horizontal"><TextBlock DataContext="{Binding}" Text="{Binding CurrentLanguageContent}" Width="{Binding Path=Width.AdjustedValue, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"  
                                           TextWrapping="Wrap" HorizontalAlignment="Left"  /><Button  x:Name="btnDel" Style="{StaticResource RibbonIconButtonStyle}"  HorizontalAlignment="Right"
                                            common:CreateCommandBinding.Command="{Binding Path=DeleteLangTextCmd}"
                                             PreviewMouseLeftButtonDown="btnDel_PreviewMouseLeftButtonDown"
                                             Width="20" Height="20"  ><Button.Content><Rectangle Fill="{Binding Path=Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button} }"
                                                    OpacityMask="{DynamicResource DeleteIcon}"  Margin="0,0,5,0" Width="Auto" Height="Auto" 
                                          HorizontalAlignment="Stretch"   /></Button.Content></Button></StackPanel></DataTemplate></ComboBox.ItemTemplate></ComboBox>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>