Skip to content

Commit a4f053c

Browse files
committed
Add CompletionList.ScrollIntoView() method.
1 parent 7814eef commit a4f053c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ICSharpCode.AvalonEdit/CodeCompletion/CompletionList.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
192192
/// <summary>
193193
/// Gets/Sets the selected item.
194194
/// </summary>
195+
/// <remarks>
196+
/// The setter of this property does not scroll to the selected item.
197+
/// You might want to also call <see cref="ScrollIntoView"/>.
198+
/// </remarks>
195199
public ICompletionData SelectedItem {
196200
get {
197201
return (listBox != null ? listBox.SelectedItem : null) as ICompletionData;
@@ -204,6 +208,17 @@ public ICompletionData SelectedItem {
204208
}
205209
}
206210

211+
/// <summary>
212+
/// Scrolls the specified item into view.
213+
/// </summary>
214+
public void ScrollIntoView(ICompletionData item)
215+
{
216+
if (listBox == null)
217+
ApplyTemplate();
218+
if (listBox != null)
219+
listBox.ScrollIntoView(item);
220+
}
221+
207222
/// <summary>
208223
/// Occurs when the SelectedItem property changes.
209224
/// </summary>

0 commit comments

Comments
 (0)