c# - How to get the uri of ResourceDictionary.XAML in WPF -


if want change resourcedictionary in code, have write long path, new uri(@"pack://application:,,,/myproject;component/system/language/window1_en.xaml", urikind.absolute). there way can use using file name (window11_en.xaml) path of project (/system/language) ?

first of need have property store file path

public string xmlfilepath{get;set;} 

now, have application base directory, , concatenate path, example have created:

 static string path = system.appdomain.currentdomain.basedirectory;         static string debug = path.getdirectoryname(path);         static string bin = path.getdirectoryname(debug);         static string projectfolder = path.getdirectoryname(bin);         public string xamlfilepath = projectfolder + "\\system\\language\\window1_en.xaml"; 

or if in bin/debug try using one

xmlfilepath= system.appdomain.currentdomain.basedirectory + "your folder name , file name path come here"; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -