Hi @Owsen, Craig ,
To inject the dependency service in the Raozr files, you need to register these services in the MainWindow.xaml.cs
file.
For example, according to the Build a Windows Presentation Foundation (WPF) Blazor app, I create a WPF aplication, and then add a IDataRepository service like this:
In the MainWindow.xaml.cs
file, register the service:
public MainWindow()
{
InitializeComponent();
var serviceCollection = new ServiceCollection();
serviceCollection.AddWpfBlazorWebView();
serviceCollection.AddTransient<IDataRepository, DataRepository>(); //register the service
Resources.Add("services", serviceCollection.BuildServiceProvider());
}
After that in the Counter.cshtml page, we can inject the Service:
And the result as below:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion