TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Herve NDILIMABAKA
NA
75
7.9k
How to disable a ComboBox item in a DataTemplate in wpf c#
Dec 30 2017 9:10 PM
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
Answers (
2
)
print data grid with crystal report in WPF(C#)
using MVC in WPF