Resolve Service in codebehind of view

Topics: Questions
Jan 28, 2015 at 8:23 AM

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.
Jan 28, 2015 at 8:25 AM
var dependencyResolver = this.GetDependencyResolver(); // This always uses the right scope
var languageService = dependencyResolver.Resolve<ILanguageService>();
Jan 28, 2015 at 8:43 AM

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.
Jan 28, 2015 at 8: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 8:53 AM
Ok. Thanks for your help.