WIn Forms loading labels from resx file - winforms

I'm creating a windows forms application. I have all of my resource strings (resx files) in its own project within the solution. Is it possible to reference those resource files at design time?
Coming from web (ASP.Net MVC) we were able to add a reference in the view to the resource file(s) we needed. Am I able to do something similar and set the labels at design time?

Not unless you are prepared to go down the route of using Localizable forms - see WinForms strings in resource files, wired up in designer

Related

Loading external XAML file into a WPF project? The file is our "styles"

Has anyone had experience, or is it even possible to load an external XAML file into a WPF project from a hosted website.
We are wondering because we are defining the XAML file as our "styles". We would like a person not familiar with XAML to edit the file and then we don't have to redeploy the whole application, but next time the application loads it will just reference the changed XAML file.
Or is this not possible because the XAML files are compiled into the project?
Or would an option be to load an external XML file in code behind and populate our "style" properties that way? Is this possible?
We currently are using ResourceDictionary and calling an internal XAML file in the application, but we would like a more dynamic solution.
Using XamlReader.Load you can use the XAML parser. There is a performance hit from parsing XAML instead of BAML, and downloading a file from the network could negatively impact the (in my experience) often already slow startup times for WPF applications. The blog entry below provides a nice explanation of dynamically loading resource dictionaries.
http://blogs.interknowlogy.com/2011/09/02/xamlreader-looseresourcedictionaryfiles-parsercontext/

Reading PRISM & Unity configuration from multiple files

Can we have Unity configuration in file other than app.config file of the application? If yes, how to do it?
Can we combine unity configuration spread across multiple files?
How to define Unity configuration in the XAML file? (PRISM modules can be configured in XAML.)
Is it possible to have custom implementation of the Microsoft.Practices.Unity.Configuration.UnityConfigurationSection configuration reader class?
We are developing a WPF application which should allow other developers (working on various ares of the enterprise app) to register their XAML views (user controls) with our application. And depending on the functionality being used, our product will navigate user to the appropriate form/view. E.g. On click of the "Home" button, user would be navigated to the "Dashboard". But Dashboard may or may not be developed by the core product.
I am using Prism 4.1.
I believe that pretty much everything you need is explained in the following section of Unity's documentation:
Using Design-Time Configuration
It describes how to load one or several "configurations" into a Unity container from the default configuration file or from several other independent files.
Based on this, I believe you should be able to have a configuration file in each of your modules and load them manually in the Initialize method (or the module classes' constructors). If not, you can always register the corresponding type mappings programatically in the modules too.

Client XAML Customization in Silverlight

I am working in Silverlight 4.0 and have created a web application which is intended to be used as a utility for others. I have set up several screens using XAML in particular configurations as the UI, however I imagine that some people would like the option to customize the pages of the application. Is there a way they can do this? The XAML is not in the XAP file, it is compiled into a DLL, so
The answer depends on what kind of customization you want to offer your users. If you want users to be able to rearrange elements of the UI, you would not have them modify XAML. You would want to implement a "web part" interface in which users can move elements of the screen around, similar to Visual Studio. The major control vendors (e.g. Telerik, Intersoft, etc) include a Docking-style control.

dynamic inline silverlight from string without files

for my final project in university i am developing in asp.net mvc3 and using silverlight for vector graphics.
I store silverlight code as string/xml in a database, and i want the ability to manipulate it dynamically (change proportions etc..) and display it in my aspx view. i don't want and can't use files because of scalability issues (there will be a lot of them) and because of possible porting of the application to the cloud (Azure).
basically i want to build a controller that will take raw xaml code from the DB and display it. all the solutions i found on the web are about two options which is not helpful for me:
http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx - which involves manually creating the entire dom object and integrating it in an existing silverlight page, which i don't have
http://visualstudiomagazine.com/articles/2008/01/21/using-inline-xaml-with-silverlight-listing-2.aspx - using embedded header in the html itself - again not pracrtical..
maybe someone can suggest me a practical solution for my problem
I would suggest the you spend sometime examining in detail how the Silverlight navigation framework can be used.
I'm think you should be able to use the Frame element with your own implementation of INavigationContentLoader assigned to its ContentLoader property and possibly your own derivative to UriMapperBase assigned to its UriMapper property.
You would then use a URL like this:-
http://yoursite.com/yourHostController#/yourXamlController/someReference
You would have two views, "yourHost" would simply generate the HTML nececessary to host the Silverlight application you will build. The "yourXaml" view would simply serve up the raw Xaml.
Your Uri mapper will take the relative url supplied after the # (this is how silverlight intra-application navigation works) and create a Uri that can points at yourXaml controller.
Your implementation of INavigationContentLoader will then fetch the Xaml from the Uri and load it up.
Assuming the Xaml contains hyperlinks to using urls like "/yourXamlController/otherReference". You should be able to navigate around your stored Xaml without reloading the Silverlight app. Everything will be about referencing and downloading new chunks of Xaml.

Resources for both WPF and Silverlight in the same assembly

I have resources in separate assemblies to be used by multiple WPF apps and this is working fine. Now I am creating a Silverlight 3 app and am trying to use the same assembly to get the same resources. I get an error at the time of adding a reference, saying only Silverlight assemblies can be referenced.
What's the best way for me to do this? Must I have 2 separate sets of assemblies for resources - one for WPF and one for Silverlight? I would not like to maintain two distinct but identical resource assemblies...
Thanks
Note: "link-adding" a file resolved the issue of sharing the same xaml across multiple assemblies. However, to me, one major drawback is that this feature is not supported in Blend 3! Blend keeps trying to find the file locally in the project tree.
Unfortunately, .NET assemblies cannot be referenced from a Silverlight app.
For details and possible solutions, see http://www.pagebrooks.com/archive/2008/10/11/sharing-code-between-.net-and-silverlight-platforms.aspx.
Can you store the resources externally and then use a pre-build step to copy the files into a silverlight assembly that you reference in your project? That was you can avoid having duplicate assemblies and just change the resources in a single location.

Resources