Prism Library in .Net Core 3.1 WPF - wpf

When i select the "Prism Full App (.Net Core)" project template in Visual Studio 2019 and then select Unity as my dependency injection container, the solution created uses the DryIoc dependency injection container instead. This is in .NET Core 3.1.

While the template itself looks fine at first glance, it would seem that you have found a bug in the Prism Template Pack. You can report it by opening an issue on GitHub in the Templates Repo https://github.com/PrismLibrary/Prism.Templates/issues/new/choose
As a work around you can edit the csproj and change Prism.DryIoc to Prism.Unity...

Related

Host a standard UWP control in a WPF app using XAML Islands

I have used the following example to host a standard UWP control in a WPF app using XAML Islands:
https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/host-standard-control-with-xaml-islands
But if I get to the point:
In your WPF project, right-click the Dependencies node and add a reference to your UWP app project.
I get the following error:
Unable to add a reference to project…
Why isn't this working?
In your WPF project, right-click the Dependencies node and add a reference to your UWP app project.
I'm afraid you could not add the UWP project to WPF App (.NET Framework). Because it does not contain Dependencies option.
I tried create .NET Core WPF App(if you want to create a WPF App (.NET Core) project, you must first install the latest version of the .NET Core 3 SDK.) app and add UWP reference, and it's success. And Please make sure the target version and minimum version are both set to Windows 10, version 1903 or later.

How do I add a new WPF UserControl to my .NetCore 3.1 application?

How do I create a WPF UserControl using .Net Core 3.1 in Visual Studio 2019?
I looked through the default templates available in "Add .. New .. Dialog," but I don't seem to see it.
Am I missing something?
Do I need to add it from a the command line?
I've got the DevExpress WPF/.Net Core packages installed and can add a DevExpress flavoured UserControl.
I'm able to create/add one of those from the installed templates.
How do I do so in vanilla .NetCore/WPF
Thanks,JohhB
Same as WinForms...compile your code, open Toolbox, drag it from there onto either your designer page or into the XAML code directly.

Image tag in WPF in .net core 3.0 not working

I am working on a WPF application using .net core 3.0 preview.
I tried the following line of xaml code in both .net core 3.0 preview and .net framework.
<Grid>
<Image Source="system-tray.jpg"/>
</Grid>
This works fine in .Net Framework but doesn't work in .Net Core 3.0 preview
Any thoughts!..
For those coming by here in the future looking for an answer, like I did, here's the thing to check:
Make sure the Build Action for your image files in Visual Studio is set to "Resource". This can be checked by right-clicking the image file in the Solution Explorer and selecting "Properties".
Source: github.com/dotnet/wpf/issues/292 per question comment by Clemens

Using Mahapps.Metro Flyouts in Elementhost

I'm writing a SolidWorks addin, where I can host WPF only within an Winforms Elementhost. Now I want to use a Flyout from Mahapps.Metro, which depens on being hosted in a MetroWindow. Is there any way I can use the Flyout from within a WPF Usercontrol? I'm using .NET 4.6.2, Mahapps.Metro 1.6 and SolidWorks 2018.
Looks like the Information I found here and here is obsolete. I just installed the NuGet Packages Mahapps.Metro and Mahapps.Metro.Iconpacks and everything is working as expected.
If someone is trying to do it in a SolidWorks Addin too, make sure to manually load a new version of System.Windows.Interactivity, because Solid is loading an old version from the application base directory, which is not compatible with Mahapps.Metro!
Be very careful when you are working with .NET add-ins for solidworks. If your application uses some third-party UI lib, you need to copy those referenced assemblies to the host application (sldworks.exe) directory. For some reason, the domain application is that of hosting exe and not the dll. CLR will look for references in the sldworks.exe's directory and it doesn't find, the application throw some nasty exception that will crash your SOLIDWORKS.

Extended DataGrid in Silverlight

How can I add this (ExtendedDataGrid) to my Silverlight project ?
Here is the link to the project I am referring to
http://wpfextendeddatagrid.codeplex.com
Error is:
You can't add a reference to ExtendedGrid.dll as it was not built
against the Silvelright runtime. Silverlight projects will only work
with Silverlight assemblies.
That project was built for WPF and not Silverlight.
This is extended version of WPF toolkit DataGrid control.
Please note: As code of wpf datatgrid in wpftoolkit is moved inside
ExtendedDataGrid project , kindly update Microsoft.Windows.Controls
namespace to ExtendedGrid.Microsoft.Windows.Controls to use existing
objects.
The error message you included in your post states as much.
Silvelright projects will only work with Silvelright assemblies
Remember Silverlight is a stripped down version of .Net used for the browser plugin, and as such will not work with full version of .Net.
Unless you actually go into the source code of that project and try to port it to silverlight then there is currently no other way for you to add that project to your Silverlight project.
I would advise looking into the Silvelright toolkit and it's datagrid. It may not be as full featured as the one you are trying to reference but it covers the basic requirements for a datagrid in silverlight. There are also some open sourced versions that have been extended for silvelright.

Resources