Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 12th, 2012  |  syntax: None  |  size: 1.58 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Record added in database not updated in the form?
  2. filteredProductList.Clear();
  3. foreach(Formulation frm in dbContext.Formulations)
  4. {
  5.     filterViewedList.Add(frm);
  6. }
  7.        
  8. private void loadData()
  9. {
  10.     try
  11.     {
  12.         filterViewedList= new ObservableCollection<Formulation>(dbContext.Formulations);
  13.         dgRecords1.ItemsSource = filterViewedList;
  14.     }
  15.        
  16. <DataGrid Height="387"  x:Name="dgRecords1" Margin="0,0,64,0"  
  17.     IsSynchronizedWithCurrentItem="True"  Style="{DynamicResource StyleDatagrid}"
  18.     ClipboardCopyMode="None" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}"                
  19.     SelectionChanged="dgRecords1_SelectionChanged" Grid.Column="1" Grid.Row="3">
  20.  
  21.     <DataGrid.Resources>
  22.         <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightBlue"/>
  23.     </DataGrid.Resources>
  24.  
  25.     <DataGrid.Columns>
  26.         <DataGridTextColumn Width="110" Header="Code" Binding="{Binding FrmltnNo, Mode=TwoWay}" IsReadOnly="True" Foreground="Black"/>
  27.         <DataGridTextColumn Width="415" Header="Description" Binding="{Binding FrmltnName, Mode=TwoWay}" IsReadOnly="True" Foreground="Black"/>
  28.  
  29.         <DataGridTextColumn Width="*" Header="Status" Binding="{Binding Status, Mode=TwoWay}" IsReadOnly="True" >
  30.             <DataGridTextColumn.CellStyle>
  31.                 <Style TargetType="{x:Type DataGridCell}">
  32.                     <Setter Property="Foreground" Value="{Binding Converter={StaticResource FGColorKey}}"/>
  33.                 </Style>
  34.  
  35.             </DataGridTextColumn.CellStyle>
  36.         </DataGridTextColumn>
  37.  
  38.     </DataGrid.Columns>
  39. </DataGrid>