-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FontFamily - Combobox and TextBox (inputfield) #12
Comments
MGTextBox textBox = ...;
MGTextBlock textBlockComponent = textBox.TextBlockComponent.Element;
bool success = textBlockComponent.TrySetFont("familyname", fontSize); Whichever family name you use must have already been registered to the MGDesktop desktop = ...;
FontManager fm = desktop.FontManager;
fm.AddFontSet(new FontSet(...)); Note: If your For MGComboBox<double> comboBox = ...; // suppose we had a combobox whose ItemsSource is a collection of doubles
comboBox.DropdownItemTemplate = (item) =>
{
string text = item.ToString("0.00"); // convert the decimal to a string with 2 decimal places
MGButton button = comboBox.CreateDefaultDropdownButton(); // create the button that will host this combobox item
// Create the content of the button and customize its font family etc
MGTextBlock textContent = new MGTextBlock(comboBox.ParentWindow, text);
bool success = textContent.TrySetFont("fontFamily", 16);
button.SetContent(textContent);
return button;
}; There are also a couple settings named MGDesktop desktop = ...;
MGTheme theme = desktop.Theme; // Note: If the `MGWindow` specifies a theme, that theme would take priority. See also: MGElement.GetTheme()
theme.FontSettings.DefaultFontFamily = "fontFamilyName..."; The other one is an in instance property in MGDesktop desktop = ...;
FontManager fm = desktop.FontManager;
fm.DefaultFontFamily = "fontFamilyName..."; If a default is specified in both |
How is it possible to change the FontFamily of these controls? (and maybe some others) To achieve a consistent look I would like to modify their font but FontFamily is an unknown property.
Thanks in advance!
The text was updated successfully, but these errors were encountered: