I must use in windows .net.core and i ask if there is a port of wpf for this technologies. if yes can help me to find where can find some info? and can i use the ef core?
Loading
I must use in windows .net.core and i ask if there is a port of wpf for this technologies. if yes can help me to find where can find some info? and can i use the ef core?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Tuhin PaulRank #7 · 71.9K reputationPosted May 31, 2024, 2:30 PM EDT
Yes you can leverage WPF (Windows Presentation Foundation) to create desktop applications within a .NET Core environment.
Microsoft made WPF available for .NET Core 3.0, aiming for feature parity with the .NET Framework version. While some minor differences might exist, they should be manageable.
Install the EF Core NuGet Package:
Microsoft.EntityFrameworkCore.Sqlitepackage (or another provider if you prefer a different database).Create a Data Model:
Configure EF Core:
Access Data in Your WPF Application:
Tuhin PaulRank #7 · 71.9K reputationPosted May 31, 2024, 2:31 PM EDT
// Data model class (replace with your table structure) public class Customer { public int CustomerID { get; set; } public string Name { get; set; } } // DbContext class (replace with your connection string) public class MyDbContext : DbContext { public DbSet Customers { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite("Data Source=mydatabase.db"); } } // WPF code-behind file (example usage) public partial class MainWindow : Window { private MyDbContext _context; public MainWindow() { InitializeComponent(); _context = new MyDbContext(); } private void LoadCustomersButton_Click(object sender, RoutedEventArgs e) { var customers = _context.Customers.ToList(); // Bind customers to your WPF list or display them as needed } }