Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
How to disable a ComboBox item in a DataTemplate in wpf c#
Herve NDILIMABAKA
Dec 30 2017 9:10 PM
188
Hi everybody
I have a DataGrid control for which one of the columns consists in ComboBox controls defined in a DataTemplate (refer to the xaml snippet below).
The ComboBox controls are populated through data binding and everything works fine.
My problem: I would like to disable (from code behind) the selected ComboBox control item as long as the treatment associated to that selection is not complete.
Any idea, comment, suggestion?
Here is the xaml snippet:
<DataGrid Name="onGoingActionsGrid" AutoGenerateColumns="False" Background="Transparent" BorderBrush="Transparent"
CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserResizeColumns="False">
<datagrid.columns>
<DataGridTextColumn Header="Actions" Width="235" Binding="{Binding Name}"/>
<DataGridTemplateColumn Header="State" IsReadOnly="True" Width="40">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<DataGridTemplateColumn Header="Control" Width="50">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<ComboBox x:Name="ControlActionComboBox"
ItemsSource="{Binding CollectionOfPictograms, Mode=TwoWay}"
SelectionChanged="controlAction_SelectionChanged"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
SelectedValuePath="Content">
<combobox.itemcontainerstyle>
<Setter Property="Padding" Value="4.3"/>
<Setter Property="BorderBrush" Value="LightGray"/>
<Setter Property="BorderThickness" Value="1"/>
<combobox.itemtemplate>
<datatemplate>
<dockpanel>
Reply
Upload Source Code
Select only zip and rar file.
Post
Reset
Answers (
2
)
print data grid with crystal report in WPF(C#)
using MVC in WPF