本文整理汇总了C#中System.Windows.Controls.TextBlock.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TextBlock.GetValue方法的具体用法?C# TextBlock.GetValue怎么用?C# TextBlock.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.TextBlock
的用法示例。
在下文中一共展示了TextBlock.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsRequiredForFormPropertyTest
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: SimpleUIUsingResourceDictionary
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);
}
示例3: GetWeibo
public static WeiboStatus GetWeibo(TextBlock textblock)
{
return textblock.GetValue(WeiboProperty) as WeiboStatus;
}
示例4: RecreateInlines
private static void RecreateInlines(TextBlock t, IEnumerable<Inline> list)
{
RecreateInlines(t, (Inline) t.GetValue(PrefixInlineListProperty), list);
}
示例5: GetInlinesList
public static IEnumerable<Inline> GetInlinesList(TextBlock element)
{
return (IEnumerable<Inline>) element.GetValue(InlinesListProperty);
}
示例6: GetHighlightBrush
public static Brush GetHighlightBrush(TextBlock element)
{
return (Brush)element.GetValue(HighlightBrushProperty);
}
示例7: GetIsTextTrimmed
public static bool GetIsTextTrimmed(TextBlock target) => (bool) target.GetValue(IsTextTrimmedProperty);
示例8: GetInline
public static string GetInline(TextBlock element)
{
return (element != null) ? element.GetValue(ArticleContentProperty) as string : string.Empty;
}
示例9: LabeledByPropertyTest
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");
}
示例10: GetInlineList
/// <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;
}
示例11: GetFormattedText
/// <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: GetTextForegroundRespondsToSelection
public static bool GetTextForegroundRespondsToSelection(TextBlock obj)
{
return (bool)obj.GetValue(TextForegroundRespondsToSelectionProperty);
}
示例13: GetValueFormat
/// <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: GetText
public static string GetText(TextBlock element)
{
return (string)element.GetValue(TextProperty);
}
示例15: InsertTokens
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;
}