-
-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from skadefro/master
Implement simple intellisense
- Loading branch information
Showing
24 changed files
with
1,507 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<ToolTip x:Class="OpenRPA.ExpressionEditor.AutoCompletionPopup" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:OpenRPA.ExpressionEditor" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid Name="MainGrid" Width="300" Height="200" > | ||
<ListBox Name="AutoCompletionListBox" IsTextSearchEnabled="True" | ||
ItemsSource="{Binding Path=.}" VirtualizingStackPanel.IsVirtualizing="True" | ||
ScrollViewer.VerticalScrollBarVisibility="Auto" | ||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | ||
<ListBox.ItemContainerStyle> | ||
<Style TargetType="{x:Type ListBoxItem}"> | ||
<EventSetter Event="MouseDoubleClick" Handler="OnListBoxItemDoubleClick" /> | ||
</Style> | ||
</ListBox.ItemContainerStyle> | ||
<ListBox.ItemTemplate> | ||
<DataTemplate> | ||
<TextBlock Width="Auto" Text="{Binding Path=Name}" | ||
ToolTip="{Binding Path=Description}" Margin="2" /> | ||
</DataTemplate> | ||
</ListBox.ItemTemplate> | ||
</ListBox> | ||
</Grid> | ||
</ToolTip> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace OpenRPA.ExpressionEditor | ||
{ | ||
/// <summary> | ||
/// Interaction logic for AutoCompletionPopup.xaml | ||
/// </summary> | ||
public partial class AutoCompletionPopup : ToolTip | ||
{ | ||
public AutoCompletionPopup() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
/// <summary>Occurs when an item in the auto-completion list is double clicked.</summary> | ||
public event MouseButtonEventHandler ListBoxItemDoubleClick; | ||
|
||
/// <summary>Gets or sets the selected item in the auto-completion list</summary> | ||
public ExpressionNode SelectedItem | ||
{ | ||
get { return (ExpressionNode)this.AutoCompletionListBox.SelectedItem; } | ||
set { this.AutoCompletionListBox.SelectedItem = value; } | ||
} | ||
|
||
/// <summary>Gets or sets the index of the selected item in the auto-completion list.</summary> | ||
public int SelectedIndex | ||
{ | ||
get { return this.AutoCompletionListBox.SelectedIndex; } | ||
set | ||
{ | ||
// Protect against the index under- or over-ranging. | ||
if (value < -1 || value > this.AutoCompletionListBox.Items.Count - 1) return; | ||
|
||
this.AutoCompletionListBox.SelectedIndex = value; | ||
this.AutoCompletionListBox.ScrollIntoView(this.AutoCompletionListBox.SelectedItem); | ||
} | ||
} | ||
|
||
/// <summary>Gets the number of items in the auto-completion list.</summary> | ||
public int Count | ||
{ | ||
get { return this.AutoCompletionListBox.Items.Count; } | ||
} | ||
/// <summary>Occurs when an item in the auto-completion list is double-clicked.</summary> | ||
/// <param name="sender">The object from which the event initiated.</param> | ||
/// <param name="e">The object that contains the event data.</param> | ||
protected void OnListBoxItemDoubleClick(object sender, MouseButtonEventArgs e) | ||
{ | ||
if (this.ListBoxItemDoubleClick != null) this.ListBoxItemDoubleClick.Invoke(sender, e); | ||
} | ||
} | ||
} |
Oops, something went wrong.