Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App.XAML where are you?

Tags:

wpf

I am new in WPF. Created a new WPF UserControl. See that some people uses an app.xaml file in order to set inside application level ressources.

My solution consists of a WinForm and a WPF UserControl. I don't see somewhere any app.xaml file.

How to proceed?

like image 734
serhio Avatar asked Sep 16 '10 10:09

serhio


2 Answers

App.xaml is associated with a WPF application. If you've only got a UserControl, there's no application for it to be part of, is there?

Create a WPF application and you'll have an App.xaml to put application-level resources in.

Out of interest, why do you have WinForm if you're using a WPF user control?

EDIT: To repeat my comment: you're not going be provided with WPF Application resources smoothly when you're not creating a WPF application.

EDIT: As noted in Anthony Brien's answer, it seems you can hack it around - but I would strongly recommend against this sort of thing if you can possibly help it. Fundamentally, you're working against the expectations of the platform - and that's never a nice situation to be in.

like image 188
Jon Skeet Avatar answered Sep 28 '22 08:09

Jon Skeet


It is possible to have application wide WPF resources in a WinForms application. Look at http://www.wpftutorial.net/AppLevelResourcesWinForms.html

like image 35
Anthony Brien Avatar answered Sep 28 '22 06:09

Anthony Brien