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

WPF enabling and disabling items inside a ListView

$
0
0

Hey Guys,

I'm working on a ListView that has a ComboBox as one of the added items.  Here is the XAML for the ListView:

<ListView x:Name="Item_List" HorizontalAlignment="Left" Height="299" ItemsSource="{Binding Pic_Items}" Margin="10,100,0,0" VerticalAlignment="Top" Width="652" SelectionChanged="ListView_SelectionChanged_1"><ListView.View><GridView><GridViewColumn Header="Pic Number" Width="80" DisplayMemberBinding="{Binding Path=PicNumber}"/><GridViewColumn Header="Select Picture" Width="220" ><GridViewColumn.CellTemplate><DataTemplate><ComboBox x:Name="CBX" Width="200" IsEnabled="False" 
                                          ItemsSource="{Binding Path=PicName}" SelectionChanged="ComboBox_SelectionChanged_1"/><DataTemplate.Triggers><DataTrigger Binding="{}" Value="True"><Setter TargetName="CBX" Property="IsEnabled" Value="True" /></DataTrigger></DataTemplate.Triggers></DataTemplate></GridViewColumn.CellTemplate></GridViewColumn></GridView></ListView.View></ListView>

What I really want to focus on is the ComboBox.  What I want to be able to do is have all the ComboBoxes disabled and then enable the one for the selecteditem.  I want to force the user to select the listitem and then they will be able to use the combobox for only the that item.  I've taken a stab at this but I'm running into a wall.  I think that I should be able to bind the "IsEnabled" property of the combobox to the lineitems "IsSelected" property.  I just don't understand binding well enough to do this.  I'm also not sure that it will work although it should be doable in theory.  Anyway, can you guys let me know if I'm on the right track and how to handle the binding here.  Thanks!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



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