Resolve Service in codebehind of view

Topics: Questions
Jan 28, 2015 at 9:23 AM
Hi

I have to generate dynamic columns of a gridcontrol in code behind of the view.
Whats the best way to resolve the languageservice in code behind.
Coordinator
Jan 28, 2015 at 9:25 AM
var dependencyResolver = this.GetDependencyResolver(); // This always uses the right scope
var languageService = dependencyResolver.Resolve<ILanguageService>();
Jan 28, 2015 at 9:43 AM
Ok.

And is there also a way to set LanguageBinding in Code?

For example:
var stationBand = new GridControlBand { Header = "Stations" };
If I use instead of "Stations" -> languageService.GetString("Stations");
The correct language is resolved at start but not changable at runtime.
Coordinator
Jan 28, 2015 at 9:45 AM
Xaml is just a wrapper around C# code, so yes that's possible. Just search the internet on how to use markup extensions in code.
Jan 28, 2015 at 9:53 AM
Ok. Thanks for your help.