meine Sys/Db admin & Developper Notitzen - wer Rechtschreibfehler findet darf sie behalten ... my Sys/Db Admin and developper notes - I don't care about typos
Monday, September 14, 2015
simple wpf entity framework databinding to ms DataGridView and Telerik RadGridView
main Xaml Window:
Codebehind:
namespace WpfApplication1
{
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window
{
StpDbEntities1 _stpDbEnt = new StpDbEntities1();
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MyDataGrid.ItemsSource = _stpDbEnt.tMachine.Local;
MyRadGridView.ItemsSource = _stpDbEnt.tMachine.Local;
_stpDbEnt.tMachine.Load();
//Window1 w1=new Window1();
//w1.Show();
//Show first Name - not necesarry
var machinename = _stpDbEnt.tMachine.First().Name;
if (machinename == null) throw new ArgumentNullException("machinename");
MessageBox.Show(machinename);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_stpDbEnt.SaveChanges();
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment