Exemplo n.º 1
0
            void OnIsInErrorPropertyChanged(bool oldValue, bool newValue)
            {
                // We need to have a good template for this to work
                if (m_textBlock == null)
                {
                    return;
                }

                if (newValue)
                {
                    // If there's an error message we need to override the normal display font
                    // with the font appropriate for this language. This is because the error
                    // message is localized and therefore can contain characters that are not
                    // available in the normal font.
                    // We use UIText as the font type because this is the most common font type to use
                    m_textBlock.FontFamily = LocalizationService.GetInstance().GetLanguageFontFamilyForType(LanguageFontType.UIText);
                }
                else
                {
                    // The error result is no longer an error so we will restore the
                    // value to FontFamily property to the value provided in the style
                    // for the TextBlock in the template.
                    m_textBlock.ClearValue(TextBlock.FontFamilyProperty);
                }
            }