Skip to content

Commit f772542

Browse files
committed
add Load() method
1 parent 17b9b32 commit f772542

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Input/RichSuggestBox/RichSuggestBox.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ public void AddTokens(IEnumerable<RichSuggestToken> tokens)
126126
}
127127
}
128128

129+
/// <summary>
130+
/// Populate the <see cref="RichSuggestBox"/> with an existing Rich Text Format (RTF) document and a collection of tokens.
131+
/// </summary>
132+
/// <param name="rtf">The Rich Text Format (RTF) text to be imported.</param>
133+
/// <param name="tokens">The collection of tokens embedded in the document.</param>
134+
public void Load(string rtf, IEnumerable<RichSuggestToken> tokens)
135+
{
136+
Clear();
137+
AddTokens(tokens);
138+
TextDocument.SetText(TextSetOptions.FormatRtf, rtf);
139+
}
140+
129141
/// <summary>
130142
/// Try getting the token associated with a text range.
131143
/// </summary>

0 commit comments

Comments
 (0)