I have Six combobox, Date picker and Textbox and Datagrid in my page I want to update that Datagrid when user select Items from combobox and Date at Run Time (values of combobox, Date picker and Textbox should be Reflected in Datagrid) How can I Do That in WPF are their any samples Available
in xmal
<Grid Height="477" Width="790">
<Grid Margin="10,10,12,12">
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Image Height="26" HorizontalAlignment="Left" Margin="3,5,0,0" Name="image1" Source="/WpfApplication3;component/Images/opre.jpg" Stretch="Fill" VerticalAlignment="Top" Width="100" />
<Image Height="44" HorizontalAlignment="Left" Margin="461,400,0,0" Name="image35" Source="/WpfApplication3;component/Images/Drawing.jpg" Stretch="Fill" VerticalAlignment="Top" Width="301" />
<DataGrid Name="customerDataGrid" CanUserAddRows="True" CanUserDeleteRows="True" Margin="34,56,237,73" AlternatingRowBackground="{x:Null}" MinRowHeight="10" ItemsSource="{Binding}" ></DataGrid>
<TextBlock Height="16" HorizontalAlignment="Left" Margin="554,110,0,0" Name="textBlock1" Text="Equipment" VerticalAlignment="Top" />
<TextBlock Height="15" HorizontalAlignment="Left" Margin="554,137,0,0" Name="textBlock2" Text="ID" VerticalAlignment="Top" />
<TextBlock Height="15" HorizontalAlignment="Left" Margin="554,163,0,0" Name="textBlock3" Text="Start Date" VerticalAlignment="Top" />
<TextBlock Height="16" HorizontalAlignment="Left" Margin="554,187,0,0" Name="textBlock4" Text="End Date" VerticalAlignment="Top" />
<TextBlock Height="16" HorizontalAlignment="Left" Margin="554,211,0,0" Name="textBlock5" Text="Requsted By" VerticalAlignment="Top" />
<TextBlock Height="16" HorizontalAlignment="Left" Margin="554,233,0,0" Name="textBlock6" Text="Purpose" VerticalAlignment="Top" />
<TextBlock Height="17" HorizontalAlignment="Left" Margin="568,56,0,0" Name="textBlock7" Text="ADD Maintainence Shedule" VerticalAlignment="Top" FontWeight="Bold" />
<ComboBox Height="21" HorizontalAlignment="Left" Margin="617,110,0,0" Name="comboBox1" VerticalAlignment="Top" Width="99" SelectedValue="{Binding PropertyName, Mode=TwoWay}">
<ComboBoxItem Content="LA"/>
<ComboBoxItem Content="CVT"/>
<ComboBoxItem Content="Isolator"/>
<ComboBoxItem Content="WT"/>
<ComboBoxItem Content="ICT"/>
<ComboBoxItem Content="CT"/>
<ComboBoxItem Content="PT"/>
<ComboBoxItem Content="E/S"/>
<ComboBoxItem Content="CB"/>
<ComboBoxItem Content="BUS" />
<ComboBoxItem Content="CAP" />
</ComboBox>
<ComboBox Height="21" HorizontalAlignment="Left" Margin="618,133,0,0" Name="comboBox2" VerticalAlignment="Top" Width="99" SelectedValue="{Binding PropertyName, Mode=TwoWay}">
<ComboBoxItem Content="29A/00"/>
<ComboBoxItem Content="29B/00"/>
<ComboBoxItem Content="30A/03"/>
<ComboBoxItem Content="45B/50"/>
<ComboBoxItem Content="39A/00"/>
<ComboBoxItem Content="59A/00"/>
</ComboBox>
<DatePicker Height="21" HorizontalAlignment="Left" Margin="618,157,0,0" Name="datePicker1" VerticalAlignment="Top" Width="99" Text="{Binding PropertyName, Mode=TwoWay}"/>
<DatePicker Height="21" HorizontalAlignment="Left" Margin="618,0,0,251" Name="datePicker2" VerticalAlignment="Bottom" Width="99" Text="{Binding PropertyName, Mode=TwoWay}"/>
<TextBox Height="21" Margin="618,208,51,0" Name="textBox1" VerticalAlignment="Top" Text="{Binding PropertyName, Mode=TwoWay}" />
<TextBox Height="21" Margin="618,231,51,0" Name="textBox2" VerticalAlignment="Top" Text="{Binding PropertyName, Mode=TwoWay}" />
<Button Content="Save" Height="23" HorizontalAlignment="Left" Margin="612,270,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
<TextBlock Height="16" HorizontalAlignment="Left" Margin="554,85,0,0" Name="textBlock8" Text="BAY" VerticalAlignment="Top" />
<ComboBox Height="21" HorizontalAlignment="Left" Margin="617,85,0,0" Name="comboBox3" VerticalAlignment="Top" Width="99" SelectedValue="{Binding PropertyName, Mode=TwoWay}">
<ComboBoxItem Content="Kolhapur 1" />
<ComboBoxItem Content="Kolhapur 2" />
<ComboBoxItem Content="Kolhapur 3" />
<ComboBoxItem Content="Kolhapur 4" />
<ComboBoxItem Content="Vita 1" />
<ComboBoxItem Content="Vita 2" />
<ComboBoxItem Content="Karad 1" />
<ComboBoxItem Content="Karad 2" />
<ComboBoxItem Content="Miraj" />
<ComboBoxItem Content="Pophali" />
<ComboBoxItem Content="Pedambe" />
<ComboBoxItem Content="Peth" />
<ComboBoxItem Content="Koyana 1" />
<ComboBoxItem Content="Koyana 2" />
<ComboBoxItem Content="Lonikand" />
<ComboBoxItem Content="Lamboti" />
</ComboBox>
</Grid>
</Grid>
and in xmal cs
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
customerDataGrid.ItemsSource = LoadCollectionData();
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
}
public List<Customer> LoadCollectionData()
{
List<Customer> customer = new List<Customer>();
customer.Add(new Customer()
{
Bay = "Lonikand",
Euqipment = "CAP",
ID = "29A/00",
Startmdy = "14/02/2011",
Endmdy = "15/02/2011",
Purpose = "Oiling.",
Requestedby = "Ashish.",
});
public class Customer
{
public string Bay { get; set; }
public string Euqipment { get; set; }
public string ID { get; set; }
public string Startmdy { get; set; }
public string Endmdy { get; set; }
public string Purpose { get; set; }
public string Requestedby { get; set; }
}
}