or
| <Style x:Key="RowItemStyle" TargetType="{x:Type ListViewItem}"> |
| <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
| <Setter Property="IsSelected" Value="{Binding Path=IsRowSelected, Mode=TwoWay}" /> |
| <Style.Triggers> |
| <MultiTrigger> |
| <MultiTrigger.Conditions> |
| <Condition Property="ItemsControl.AlternationIndex" Value="1" /> |
| <Condition Property="IsSelected" Value="False" /> |
| <Condition Property="IsMouseOver" Value="False" /> |
| </MultiTrigger.Conditions> |
| <Setter Property="Background" Value="#EEEEEEEE" /> |
| </MultiTrigger> |
| </Style.Triggers> |
| </Style> |
| <ListView |
| Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" |
| MaxHeight="200" |
| ScrollViewer.CanContentScroll="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" |
| ItemContainerStyle="{StaticResource RowItemStyle}" |
| ItemsSource="{Binding Path=MasterList}" IsSynchronizedWithCurrentItem="True" |
| SelectionMode="Single" |
| > |
| <ListView.View> |
| <GridView> |
| <GridViewColumn Header="Item Name" Width="Auto" DisplayMemberBinding="{Binding Path=ItemName}" /> |
| </GridView> |
| </ListView.View> |
| </ListView> |
Hello,
I have a grid connected to a DataTable.
The grid and datatable both have three columns and three rows.
I want to make a cell in column A uneditable based on a value in a cell in column B
(both cells are in the same row).
I know that I can use BeginningEdit event to cancel an edit attempt in a cell,
however I was wondering if I can reach the same result using XAML trigers
and perhaps just a small relevant class.
Thanks,
Erez


| private void ShowSelectedRecordsInChart() |
| { |
| DataTable table = new DataTable(); |
| DataColumn col = new DataColumn("Shuttle", typeof(double)); |
| table.Columns.Add(col); |
| try |
| { |
| foreach (DataRecord item in this.datagrdV02.Records) |
| { |
| DataRow row = table.NewRow(); |
| row["Shuttle"] = ((DataRow)item.Data)["Shuttle"]; |
| table.Rows.Add(row); |
| } |
| } |
| catch (Exception ex) |
| { |
| MessageBox.Show(ex.Message); |
| } |
| } |
row[
"Shuttle"] = ((DataRow)item.Data)["Shuttle"];