本文整理汇总了C#中System.Windows.Documents.Inline类的典型用法代码示例。如果您正苦于以下问题:C# Inline类的具体用法?C# Inline怎么用?C# Inline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Inline类属于System.Windows.Documents命名空间,在下文中一共展示了Inline类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: _AddLineImpl
protected override void _AddLineImpl( Inline inline )
{
FlowDocument.Blocks.Add( new Paragraph( inline ) {
Background = Brushes.MediumBlue,
Foreground = Brushes.White,
} );
}
开发者ID:BGCX261,项目名称:ziveirc-svn-to-git,代码行数:7,代码来源:ScrollbackDebugManager.cs
示例2: OnHtmlTextChanged
private static void OnHtmlTextChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
{
// Go ahead and return out if we set the property on something other than a textblock, or set a value that is not a string.
var txtBox = depObj as TextBlock;
if(txtBox == null)
return;
if(!(e.NewValue is string))
return;
var html = e.NewValue as string;
string xaml;
InlineCollection xamLines;
try {
xaml = HtmlToXamlConverter.ConvertHtmlToXaml(html, false);
xamLines = ((Paragraph)((Section)System.Windows.Markup.XamlReader.Parse(xaml)).Blocks.FirstBlock).Inlines;
} catch {
// There was a problem parsing the html, return out.
return;
}
// Create a copy of the Inlines and add them to the TextBlock.
Inline[] newLines = new Inline[xamLines.Count];
xamLines.CopyTo(newLines, 0);
txtBox.Inlines.Clear();
foreach(var l in newLines) {
txtBox.Inlines.Add(l);
}
}
开发者ID:mrtska,项目名称:SRNicoNico,代码行数:30,代码来源:TextBlockHtmlBehavior.cs
示例3: GetInlines
private Inline[] GetInlines()
{
Inline[] inlines = new Inline[3];
Match firstMatch = _result.TextMatches[0];
string sourceText = _result.SourceText;
int startIndex = Math.Max(0, firstMatch.Index - CHARS_TO_INCLUDE);
string prev = sourceText.Substring(startIndex, firstMatch.Index - startIndex);
inlines[0] = new Run()
{
Text = prev,
Foreground = new SolidColorBrush(Colors.Gray)
};
string match = firstMatch.Value;
inlines[1] = new Run()
{
Text = match,
Foreground = (Brush)App.Current.Resources["PhoneForegroundBrush"]
};
startIndex = firstMatch.Index + firstMatch.Value.Length;
int length = Math.Min(sourceText.Length - startIndex, CHARS_TO_INCLUDE);
string after = sourceText.Substring(startIndex, length);
inlines[2] = new Run()
{
Text = after,
Foreground = new SolidColorBrush(Colors.Gray)
};
return inlines;
}
开发者ID:hmehart,项目名称:Notepad,代码行数:33,代码来源:SearchResultListItem2.cs
示例4: Span
/// <summary>
/// Creates a new Span instance.
/// </summary>
/// <param name="childInline">
/// Optional child Inline for the new Span. May be null.
/// </param>
/// <param name="insertionPosition">
/// Optional position at which to insert the new Span. May be null.
/// </param>
public Span(Inline childInline, TextPointer insertionPosition)
{
if (insertionPosition != null)
{
insertionPosition.TextContainer.BeginChange();
}
try
{
if (insertionPosition != null)
{
// This will throw InvalidOperationException if schema validity is violated.
insertionPosition.InsertInline(this);
}
if (childInline != null)
{
this.Inlines.Add(childInline);
}
}
finally
{
if (insertionPosition != null)
{
insertionPosition.TextContainer.EndChange();
}
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:36,代码来源:Span.cs
示例5: InlineTweetView
public InlineTweetView(Inline body, Tweet tweet)
: this()
{
_tweet = tweet;
_body.Inlines.Add(body);
DataContext = this;
}
开发者ID:Doomblaster,项目名称:MetroFire,代码行数:8,代码来源:InlineTweetView.xaml.cs
示例6: Insert
public static Inline Insert(this Inline inline, Inline inlineToAdd)
{
var span = inline as Span ?? new Span(inline);
span.Inlines.Add(inlineToAdd);
return span;
}
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:8,代码来源:InlineExtensions.cs
示例7: Append
public static Inline Append(this Inline inline, Inline inlineToAdd)
{
var span = new Span(inline);
span.Inlines.Add(inlineToAdd);
return span;
}
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:8,代码来源:InlineExtensions.cs
示例8: TerminalControl
public TerminalControl()
{
InitializeComponent();
caretInline = Input.Inlines.LastInline;
RTB.PreviewMouseDown += OnControlMouseDown;
//TextReceiver.TextChanged += TextChanged;
}
开发者ID:anaimi,项目名称:farawla,代码行数:9,代码来源:TerminalControl.xaml.cs
示例9: AddIfNotNull
public static void AddIfNotNull(this InlineCollection inlineCollection, Inline inline)
{
if (inline == null)
{
return;
}
inlineCollection.Add(inline);
}
开发者ID:WildGums,项目名称:Orc.NuGetExplorer,代码行数:9,代码来源:InlineCollectionExtensions.cs
示例10: routeHyperlinks
void routeHyperlinks(Inline inl)
{
if (inl is Hyperlink)
(inl as Hyperlink).RequestNavigate += (s, e) => App.Current.OnRequestNavigate(s, e);
if (inl is Span)
foreach (var sub in (inl as Span).Inlines)
routeHyperlinks(sub);
}
开发者ID:ace13,项目名称:FList-sharp,代码行数:9,代码来源:MessageList.xaml.cs
示例11: InsertInspectedResult
public Inline InsertInspectedResult(Inline position, object obj)
{
LoadInspector(obj);
object result = _rubyEngine.InvokeMember(obj, "as_xaml");
if (result is MutableString) {
return InsertColorizedCode(position, result.ToString());
} else {
throw new NotImplementedError("do not have mechanism to insert UIElement in middle of flow document yet");
}
}
开发者ID:jflam,项目名称:repl-lib,代码行数:10,代码来源:Repl.xaml.cs
示例12: Paragraph
/// <summary>
/// Paragraph constructor.
/// </summary>
public Paragraph(Inline inline)
: base()
{
if (inline == null)
{
throw new ArgumentNullException("inline");
}
this.Inlines.Add(inline);
}
开发者ID:JianwenSun,项目名称:cc,代码行数:13,代码来源:Paragraph.cs
示例13: RemoveHyperlink
public static TextPointer RemoveHyperlink(TextPointer start)
{
var backspacePosition = start.GetNextInsertionPosition(LogicalDirection.Backward);
Hyperlink hyperlink;
if (backspacePosition == null || !IsHyperlinkBoundaryCrossed(start, backspacePosition, out hyperlink))
{
return null;
}
// Remember caretPosition with forward gravity. This is necessary since we are going to delete
// the hyperlink element preceeding caretPosition and after deletion current caretPosition
// (with backward gravity) will follow content preceeding the hyperlink.
// We want to remember content following the hyperlink to set new caret position at.
var newCaretPosition = start.GetPositionAtOffset(0, LogicalDirection.Forward);
// Deleting the hyperlink is done using logic below.
// 1. Copy its children Inline to a temporary array.
var hyperlinkChildren = hyperlink.Inlines;
var inlines = new Inline[hyperlinkChildren.Count];
hyperlinkChildren.CopyTo(inlines, 0);
// 2. Remove each child from parent hyperlink element and insert it after the hyperlink.
for (int i = inlines.Length - 1; i >= 0; i--)
{
hyperlinkChildren.Remove(inlines[i]);
hyperlink.SiblingInlines.InsertAfter(hyperlink, inlines[i]);
}
// 3. Apply hyperlink's local formatting properties to inlines (which are now outside hyperlink scope).
var localProperties = hyperlink.GetLocalValueEnumerator();
var inlineRange = new TextRange(inlines[0].ContentStart, inlines[inlines.Length - 1].ContentEnd);
while (localProperties.MoveNext())
{
var property = localProperties.Current;
var dp = property.Property;
object value = property.Value;
if (!dp.ReadOnly &&
dp != Inline.TextDecorationsProperty && // Ignore hyperlink defaults.
dp != TextElement.ForegroundProperty &&
dp != BaseUriHelper.BaseUriProperty &&
!IsHyperlinkProperty(dp))
{
inlineRange.ApplyPropertyValue(dp, value);
}
}
// 4. Delete the (empty) hyperlink element.
hyperlink.SiblingInlines.Remove(hyperlink);
return newCaretPosition;
}
开发者ID:JackWangCUMT,项目名称:Plainion,代码行数:55,代码来源:DocumentFacade.cs
示例14: LookupHyperlinks
private static void LookupHyperlinks(Inline inline)
{
if (inline is Hyperlink)
{
var hyperlink = ((Hyperlink) inline);
hyperlink.RequestNavigate += HyperlinkRequestNavigate;
}
if (inline is Span)
foreach (Inline subInline in ((Span) inline).Inlines)
LookupHyperlinks(subInline);
}
开发者ID:eNoise,项目名称:UruchieForumGadget,代码行数:11,代码来源:HtmlToFlowDocumentConverter.cs
示例15: Append
public static Inline Append(this Inline inline, Inline inlineToAdd)
{
Argument.IsNotNull(() => inline);
Argument.IsNotNull(() => inlineToAdd);
var span = new Span(inline);
span.Inlines.Add(inlineToAdd);
return span;
}
开发者ID:sk8tz,项目名称:Orc.Controls,代码行数:11,代码来源:InlineExtensions.cs
示例16: AlliSharpMessageBox
public AlliSharpMessageBox(string title, Inline[] customMessage)
{
InitializeComponent();
this.Title = title;
tbMessage.Inlines.Clear();
foreach (Inline il in customMessage)
{
tbMessage.Inlines.Add(il);
}
System.Media.SystemSounds.Asterisk.Play();
this.ShowDialog();
}
开发者ID:allisharp,项目名称:as_autoclicker,代码行数:12,代码来源:AlliSharpMessageBox.xaml.cs
示例17: Convert
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var result = base.Convert(value, targetType, parameter, culture);
var list = result as Inline[];
if (list?.LastOrDefault() is LineBreak)
{
var newList = new Inline[list.Length - 1];
Array.Copy(list, newList, list.Length - 1);
return newList;
}
return result;
}
开发者ID:aelij,项目名称:PerformanceMonitor,代码行数:12,代码来源:FormattedTextConverterNoBreak.cs
示例18: FormatInlineForID
public Inline FormatInlineForID(Inline inline, int id)
{
if (id == 1)
{
inline.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 255, 127, 53));
}
else if (id == 2)
{
inline.Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 255, 170, 53));
}
return inline;
}
开发者ID:VahidN,项目名称:PdfReport,代码行数:12,代码来源:ParagraphProcessor.cs
示例19: RecreateInlines
private static void RecreateInlines(TextBlock t, Inline prefix, IEnumerable<Inline> list)
{
t.Inlines.Clear();
if (prefix != null)
t.Inlines.Add(prefix);
foreach (var i in list)
{
t.Inlines.Add(i);
}
t.InvalidateMeasure();
}
开发者ID:ericschultz,项目名称:gui,代码行数:13,代码来源:TextBlockExtensions.cs
示例20: CheckTextBlockInherited
static public void CheckTextBlockInherited (Inline i)
{
Assert.AreEqual ("Portable User Interface", i.FontFamily.Source, "FontFamily");
Assert.AreEqual (11, i.FontSize, "FontSize");
Assert.AreEqual (DependencyProperty.UnsetValue, i.ReadLocalValue(Inline.FontSizeProperty), "FontSize local value");
Assert.AreEqual (FontStretches.Normal, i.FontStretch, "FontStretch");
Assert.AreEqual (FontStyles.Normal, i.FontStyle, "FontStyle");
Assert.AreEqual (FontWeights.Normal, i.FontWeight, "FontWeight");
Assert.IsNotNull (i.Foreground, "Foreground");
Assert.AreEqual (Colors.Black, (i.Foreground as SolidColorBrush).Color, "Foreground.Color");
Assert.AreEqual ("en-us", i.Language.IetfLanguageTag, "Language");
Assert.IsNull (i.TextDecorations, "TextDecorations");
}
开发者ID:dfr0,项目名称:moon,代码行数:15,代码来源:InlineTest.cs
注:本文中的System.Windows.Documents.Inline类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论