Esempio n. 1
0
        private void SetText()
        {
            // reduce text height scale if it doesn't fit with 5% each time
            for (var heightScale = 1.0; heightScale > 0.5; heightScale -= 0.02)
            {
                dy                  = 0;
                totalHeight         = 0;
                CapitalFontSize     = Styles.CapitalFontSize * heightScale;
                SymbolLargeFontSize = Styles.SymbolLargeFontSize * heightScale;
                SymbolFontSize      = Styles.SymbolFontSize * heightScale;
                FontSize            = Styles.FontSize * heightScale;
                LineSpacing         = Styles.LineSpacing;
                ParagraphSkip       = Styles.ParagraphSkip * heightScale;

                CardTextBox = FindById("cardtext");
                CardTextBox?.RemoveNodes();

                var layoutXml = LayoutInputConvertor.ToXml(Card.MarkdownText);

                var document = XDocument.Parse(layoutXml);
                foreach (var xElement in document.Root.Elements("p"))
                {
                    ParseParagraph(xElement);
                }
                totalHeight += FontSize * LineSpacing;
                // it fits
                if (totalHeight <= Template.MaxTextBoxHeight)
                {
                    break;
                }
            }
        }
Esempio n. 2
0
 private void CardDetail_Loaded(object sender, RoutedEventArgs e)
 {
     CardTextBox.Focus(Windows.UI.Xaml.FocusState.Keyboard);
     CardTextBox.SelectAll();
 }