예제 #1
0
		public void IsRequiredForFormPropertyTest ()
		{
			Assert.IsNotNull (AutomationProperties.IsRequiredForFormProperty, "#0");

			TextBlock block = new TextBlock ();
			block.SetValue (AutomationProperties.IsRequiredForFormProperty, true);
			Assert.AreEqual (AutomationProperties.GetIsRequiredForForm (block),
				block.GetValue (AutomationProperties.IsRequiredForFormProperty), "#1");

			Assert.IsTrue (AutomationProperties.GetIsRequiredForForm (block), "#2");
			Assert.IsTrue ((bool) block.GetValue (AutomationProperties.IsRequiredForFormProperty), "#3");
		}
예제 #2
0
        // ------------------------------------------------------------------
        // Dump Text specific data.
        // ------------------------------------------------------------------
        private static bool DumpText(XmlTextWriter writer, UIElement element, bool uiElementsOnly)
        {
            System.Windows.Controls.TextBlock text = element as System.Windows.Controls.TextBlock;
            Debug.Assert(text != null, "Dump function has to match element type.");

            // Dump text range
            if (text.HasComplexContent)
            {
                DumpTextRange(writer, text.ContentStart, text.ContentEnd);
            }
            else
            {
                DumpTextRange(writer, text.Text);
            }

            // Dump baseline info
            writer.WriteStartElement("Metrics");
            writer.WriteAttributeString("BaselineOffset", ((double)text.GetValue(TextBlock.BaselineOffsetProperty)).ToString("F", CultureInfo.InvariantCulture));
            writer.WriteEndElement();

            // Dump line array
            if (text.IsLayoutDataValid)
            {
                ReadOnlyCollection <LineResult> lines = text.GetLineResults();
                DumpLineResults(writer, lines, element);
            }

            return(false);
        }
        public SimpleUIUsingResourceDictionary()
        {
            var stack = new StackPanel();
            Content = stack;

            var textBlock = new TextBlock();
            textBlock.SetResourceReference(TextBlock.StyleProperty, SimpleResourceDictionary.TextBlockStyleKey);
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
            stack.Children.Add(textBlock);

            var local = textBlock.GetValue(TextBlock.StyleProperty);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("LstName")); //purposefully misspelled
            stack.Children.Add(textBlock);
        }
예제 #4
0
 private static void RecreateInlines(TextBlock t, Inline prefix)
 {
     RecreateInlines(t, prefix, (IEnumerable<Inline>)t.GetValue(InlinesListProperty));
 }
예제 #5
0
 public static IEnumerable<Inline> GetInlinesList(TextBlock element)
 {
     return (IEnumerable<Inline>) element.GetValue(InlinesListProperty);
 }
예제 #6
0
 public static string GetInnerHtml(TextBlock obj)
 {
     return (string)obj.GetValue(InnerHtmlProperty);
 }
예제 #7
0
 public static Brush GetHighlightBrush(TextBlock element)
 {
     return (Brush)element.GetValue(HighlightBrushProperty);
 }
 public static bool GetIsTextTrimmed(TextBlock target) => (bool) target.GetValue(IsTextTrimmedProperty);
예제 #9
0
 public static string GetInline(TextBlock element)
 {
     return (element != null) ? element.GetValue(ArticleContentProperty) as string : string.Empty;
 }
예제 #10
0
 private static void InsertTokens(TextBlock textblock, WeiboStatus status, TextRenderContext ctx)
 {
     if (textblock == null)
         return;
     if ((bool)textblock.GetValue(DesignerProperties.IsInDesignModeProperty))
         return;
     if (status == null)
         return;
     textblock.Inlines.Clear();
     var ic = new List<Inline>();
     foreach (var sent in status.tokens)
     {
         InsertToken(ic, sent,ctx);
     }
     textblock.Inlines.AddRange(ic);
     if (textblock.Inlines.Count == 0)
         textblock.Visibility = Visibility.Collapsed;
 }
 /// <summary>
 /// Retrieves the value of the <see cref="FormattedTextProperty"/> dependency property of
 /// the specified text block.
 /// </summary>
 /// <param name="obj">The text block whose property's value should be obtained.</param>
 /// <returns>The value of the property.</returns>
 public static string GetFormattedText(TextBlock obj)
 {
     return (string)obj.GetValue(FormattedTextProperty);
 }
예제 #12
0
 public static bool GetTextForegroundRespondsToSelection(TextBlock obj)
 {
     return (bool)obj.GetValue(TextForegroundRespondsToSelectionProperty);
 }
 /// <summary>
 /// Gets the value format dependency property that is set on the given text block if any.
 /// </summary>
 /// <param name="obj">The text block element.</param>
 /// <returns>The value format dependency property that is set on the given text block if any.</returns>
 public static ValueFormat GetValueFormat(TextBlock obj)
 {
     return (ValueFormat)obj.GetValue(ValueFormatProperty);
 }
예제 #14
0
 public static string GetText(TextBlock element)
 {
     return (string)element.GetValue(TextProperty);
 }
예제 #15
0
 private static void RecreateInlines(TextBlock t, IEnumerable<Inline> list)
 {
     RecreateInlines(t, (Inline) t.GetValue(PrefixInlineListProperty), list);
 }
예제 #16
0
 public static WeiboStatus GetWeibo(TextBlock textblock)
 {
     return textblock.GetValue(WeiboProperty) as WeiboStatus;
 }
예제 #17
0
        /// <summary>
        ///     The get inline list.
        /// </summary>
        /// <param name="element">
        ///     The element.
        /// </param>
        /// <returns>
        ///     The <see cref="string" />.
        /// </returns>
        public static string GetInlineList(TextBlock element)
        {
            if (element != null)
                return element.GetValue(ArticleContentProperty) as string;

            return string.Empty;
        }
예제 #18
0
 public static string GetHtmlText(TextBlock wb)
 {
     return wb.GetValue(HtmlTextProperty) as string;
 }
예제 #19
0
		public void LabeledByPropertyTest ()
		{
			Assert.IsNotNull (AutomationProperties.LabeledByProperty, "#0");

			TextBlock block = new TextBlock ();
			TextBlock labeledBy = new TextBlock();
			block.SetValue (AutomationProperties.LabeledByProperty, labeledBy);
			Assert.AreEqual (AutomationProperties.GetLabeledBy (block),
				block.GetValue(AutomationProperties.LabeledByProperty), "#1");

			Assert.AreSame (labeledBy, AutomationProperties.GetLabeledBy (block), "#2");
			Assert.AreSame (labeledBy, block.GetValue (AutomationProperties.LabeledByProperty), "#3");
		}
 public static string GetInlineExpression(TextBlock textBlock)
 {
     return (string)textBlock.GetValue(InlineExpressionProperty);
 }
예제 #21
0
		private void DefaultTestString (DependencyProperty property, 
		                                object setValue, 
						StringPropertyDelegate stringDelegate)
		{
			Assert.IsNotNull (property, "#0");

			TextBlock block = new TextBlock ();

			block.SetValue (property, setValue);
			Assert.AreEqual (stringDelegate (block), block.GetValue (property), "#1");

			Assert.AreEqual (setValue, stringDelegate (block), "#2");
			Assert.AreEqual (setValue, block.GetValue (property), "#3");
		}
예제 #22
0
 public static Boolean GetIsTextTrimmed( TextBlock target )
 {
     return (Boolean)target.GetValue( IsTextTrimmedProperty );
 }
예제 #23
0
 /// <summary>
 /// Gets the IsExcludedFromSearch property. This dependency property 
 /// indicates ....
 /// </summary>
 public static bool GetIsExcludedFromSearch(TextBlock textBlock)
 {
     return (bool)textBlock.GetValue(IsExcludedFromSearchProperty);
 }