i have a problem: I want to make little Note Application for personal use. In this little Scratchpad i have a settings menu with a combobox for all the installed Fonts.
FontFamilyDrop.ItemsSource = Fonts.SystemFontFamilies;
Now i want to save and read this value in my settings.ini file. Writing the value works perfectly by converting the SelectedItem to a string.
When the user opens the settings menu, i want to preload the current font and i dont know how to set the SelectedItem property by just having a string for lets say "Lucida Console".
I've tried this one now:
for (int i = 2; i <= FontFamilyArray.GetLength(0); i++)
{
Title = FontFamilyArray[i].ToString();
}
The problem is that it doesnt work. It throws an exception.
Now the thing that makes me confused is, that when i fill in "2" instead of i like this:
for (int i = 2; i <= FontFamilyArray.GetLength(0); i++)
{
Title = FontFamilyArray[2].ToString();
}
This way it works perfectly... Does anyone know why?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.