Create a composite control for use in .NET Core Windows Forms - winforms

I'm building a windows form app using .NET core
Is it possible to create a composite (custom) control either in the same project or a separate .NET core project. If "Yes", where can I get some information on how to do it.
If "No", can I build a composite control in any other Visual Studio frameworks that can be used by my .NET Core WinForms app?
regards
Erick

Related

I can not find the WPF App (.Net Core) template in visual studio 2019?

I have read all the topics on this. I actually have it working on Visual Studio on one computer. I have used the installer to install the necessary work loads. I have tried downloading dotnet 5 and .net core 3.1. It just will not show up on the create projects window of Visual Studio. I only get WPF App(.NET Framework) or WPF App(.NET). I want to make WPF .netcore applications and this is a roadblock. Else, I can only make .Net Framework applications that can not be used for multi-platform development. I can make a core project in the Visual Studio with wpf .netcore template and then move it to my other computer and it works fine. The template just will not show up for core project (wpf). I am taking a wpf udemey course and it tells of the advantages of using core wpf in many applications.
Open the Visual Studio Installer (This is for VS2022, but the same should apply for 2019.)
Add the ".NET desktop development" Workload (see image below) which allows you to "Build WPF, Windows Forms, and console apps using C#, VB, & F#... "
And then it will appear (or should):

Can i use .dll library targeted .net framework v3.5 in application having targeted framework 4.0?

Hello currently I'm working on desktop application using WPF. I create application by targeting .net framework 4.0. but I have facing some problems related targeted frameworks.
First there is a library which i have to use in my application.A library supports targeted .net framework v3.5 but I also want to use the DataGrid control (only available above than v4.0 targeted .net framework) for table so now i'm confuse what i should do now? how can i achieve my goal? i want to use both library + Datagrid control in my application which is targeting .net framework v4.0.
Thanks in advance :)

Consume .Net Core library from .Net standard project

I have a standard WPF application developed in .Net framework 4. Now, my client wants a website which I am planning to develop using .Net Core. In order to share the business logic, I need to move the database along business layer to a separate project and here I am planning to use .Net Core. So, all the layers i.e. Data/ Business/ API will be re-written using latest version of .Net Core.
Would I be able to reference business layer written in .Net Core from WPF (.Net Framework 4) project?
Any pointers will be highly appreciated.....
You should implement the common functionality in a .NET Standard library. You will then be able to reference this assembly from all apps that are compatible with the version of the .NET Standard that your common project targets.
The various .NET implementations target specific versions of .NET Standard and the following table on MSDN lists all versions of .NET Standard and the platforms supported: https://learn.microsoft.com/en-us/dotnet/standard/net-standard.
The latest version of .NET Core (currently 2.0 at the time of writing) implements .NET Standard 2.0. The oldest version of the .NET Framework that implements .NET Standard 2.0 is 4.6.1. This means that your WPF app should target 4.6.1 to be able to consume a .NET Standard 2.0 assembly.
.NET Core 1.0 and .NET Framework 4.5 support .NET Standard 1.0.
The .NET Framework 4.0 doesn't support any version of .NET Standard though so you should re-target your WPF app against (at least) .NET Framework 4.5.
Would I be able to reference business layer written in .Net Core from WPF (.Net Framework 4) project?
The answer is yes. You can try it: In Visual Studio create a WPF application project and a .NET Standard library project and then add a reference from the application project to the library project.
There will be NuGet packages that you cannot reference in your .NET Standard project because they only support full .NET Framework but most popular NuGet packages can be referenced from a .NET Standard project. Your question is also tagged [entity-framework-6]. If you want to use Entity Framework from a .NET Standard project you will have to use Entity Framework Core as Entity Framework 6 requires the full framework.
You should probably create a quick spike to determine if you can build your application how you intend to.

LightSwitch vs WinForms

What is the difference between Visual Studio LightSwitch and WinForms?
Why we should choose one over the other?
Update: I understand that LightSwitch is an application framework. May be the better question is, how a LighSwitch application compares to a windows forms application built with Composite Application Block (CAB)
Lightswitch is a template driven application development environment for Visual Studio. It creates Silverlight applications that use a View-Model architecture, using Entity Framework and RIA services for data access.
The applications can be run locally on the desktop with a local data store, or with a data store on a server, or run in a browser with a data store on a server.
The Lightswitch framework includes designers to create and manage most aspects of an business application such as:
Data model with validation and relationships
Screens
Menus
Queries
As of Beta 1, there is no built-in reporting engine
It's scope remains to be seen, but I believe it's targeted for development of corporate in-house applications, such as CMS systems, billing systems, etc. and also line-of-business applications, small and large scale.
WinForms or Windows Forms is the graphical API for .NET that lets you create user interfaces with forms and controls, etc. It's not a complete application development framework.
This thread compares LightSwitch to building line-of-business applications in Silverlight today:
http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/3f6161b6-33a3-4b6a-a4d8-ea693d6ba273
This video gives a high-level overview of LightSwitch
http://www.microsoft.com/showcase/en/us/details/74ed35cb-709b-46f7-8b21-2f681965ed0b
Sorry Carlos, but LightSwitch does not generate either WinForms, or WebForms projects. The only official client technology is a Silverlight client, whether it is a web application, or a desktop (OOB) application.
In the very early days, I believe the client was originally WPF, but that was changed to SilverLight some time ago.
While LS does "generate" code, it does so for its own use, not for consumption external to LS.
One imortant distinction between Lightswitch and Composite Application Block UI, is that CAB has been retired and is no longer developed.
Reference: http://msdn.microsoft.com/en-us/library/aa480450.aspx

Silverlight Business Application - ASP.Net MVC

My first question is, what is the difference between a normal Silverlight Application in Visual Studio VS. a Silverlight Business Application?!
My second question is, when I begin a new Silverlight Application Visual Studio asks whether I want to use an ASP.Net website to host the project, or an ASP.Net MVC project. HOWEVER, When I create a new Silverlight BUSINESS Application, Visual Studio does not let me specify which type of ASP.Net website I want to hose my application in and simply creates a normal ASP.Net project by default. Since I want to use ASP.Net MVC, is there a way of changing this so that I can use an MVC project by default? Or somewhere to specify which one I want to use!?
Kind regards.
Silverlight Business Application is a new template project made available through the .NET RIA Services framework.
I guess there is no out-of-the-box support for ASP.NET MVC since the .NET RIA Services only exists as a preview (which was released in july). This thread answers your questions, and it seems they are working on ASP.NET MVC support.
PS. I propose that you re-tag your question with [ria-services].

Resources