UI: grouped functions palette with category headers/icons/colors; seed full function list and categories
This commit is contained in:
parent
18c1f18210
commit
0ac4d1558f
4 changed files with 191 additions and 55 deletions
|
@ -15,6 +15,7 @@
|
|||
<conv:IsZeroConverter x:Key="IsZeroConverter" />
|
||||
<conv:WidthToSplitViewModeConverter x:Key="WidthToSplitViewModeConverter" />
|
||||
<conv:WidthToPaneOpenConverter x:Key="WidthToPaneOpenConverter" />
|
||||
<conv:CategoryToBrushConverter x:Key="CategoryToBrushConverter" />
|
||||
</UserControl.Resources>
|
||||
<!-- Replace columns with a responsive SplitView -->
|
||||
<SplitView x:Name="RootSplit"
|
||||
|
@ -132,50 +133,55 @@
|
|||
<!-- Functions flyout anchored to this button -->
|
||||
<Button Grid.Column="1" Command="{Binding ToggleFunctionsCommand}" Margin="0,0,6,0" MinHeight="40" MinWidth="40"
|
||||
AutomationProperties.Name="Toggle functions panel">
|
||||
<Button.Flyout>
|
||||
<Flyout IsOpen="{Binding IsFunctionsPanelOpen, Mode=TwoWay}" Placement="BottomEdgeAlignedLeft">
|
||||
<Border Padding="8" MinWidth="320" MaxHeight="400">
|
||||
<ScrollViewer>
|
||||
<ListBox ItemsSource="{x:Static m:FunctionDefinitionItem.DefinedFunctions}"
|
||||
BorderThickness="0"
|
||||
AutomationProperties.Name="Functions list">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="m:FunctionDefinitionItem">
|
||||
<Button x:DataType="vm:MainViewModel"
|
||||
DataContext="{Binding #Root.DataContext}"
|
||||
Command="{Binding InsertFunctionCommand}"
|
||||
CommandParameter="{Binding $parent[ListBoxItem].DataContext}"
|
||||
Background="Transparent" BorderThickness="0" Padding="8" MinHeight="44"
|
||||
AutomationProperties.Name="Insert function">
|
||||
<StackPanel Spacing="8"
|
||||
DataContext="{Binding $parent[ListBoxItem].DataContext}"
|
||||
x:DataType="m:FunctionDefinitionItem">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<TextBlock FontFamily="{StaticResource MDI}" Text="{Binding Icon}" />
|
||||
<TextBlock Text="{Binding FunctionName}" FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding FunctionDescription}" FontStyle="Italic" TextWrapping="Wrap" />
|
||||
<ItemsControl ItemsSource="{Binding FunctionArguments}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
<TextBlock Text="{Binding Value}" FontStyle="Italic" Margin="8,0,0,0" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
<TextBlock FontFamily="{StaticResource MDI}" Text="{x:Static m:IconFont.Function}" />
|
||||
</Button>
|
||||
<Button.Flyout>
|
||||
<Flyout IsOpen="{Binding IsFunctionsPanelOpen, Mode=TwoWay}" Placement="BottomEdgeAlignedLeft">
|
||||
<Border Padding="8" MinWidth="360" MaxHeight="420">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<ItemsControl ItemsSource="{x:Static m:FunctionDefinitionItem.DefinedFunctionGroups}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="m:FunctionGroup">
|
||||
<StackPanel Margin="0,0,0,8">
|
||||
<!-- Group Header -->
|
||||
<Border Background="{Binding Category, Converter={StaticResource CategoryToBrushConverter}}"
|
||||
CornerRadius="6" Padding="8" Margin="0,0,0,6">
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
|
||||
<TextBlock FontFamily="{StaticResource MDI}" Text="{Binding Icon}"/>
|
||||
<TextBlock Text="{Binding GroupName}" FontWeight="Bold"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Group Items: simple rows -->
|
||||
<ListBox ItemsSource="{Binding Functions}" BorderThickness="0" SelectedIndex="-1">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="m:FunctionDefinitionItem">
|
||||
<Button x:DataType="vm:MainViewModel"
|
||||
DataContext="{Binding #Root.DataContext}"
|
||||
Command="{Binding InsertFunctionCommand}"
|
||||
CommandParameter="{Binding $parent[ListBoxItem].DataContext}"
|
||||
Background="Transparent" BorderThickness="0" Padding="8" MinHeight="36"
|
||||
AutomationProperties.Name="Insert function">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Signature}" FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding FunctionDescription}" Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
<TextBlock FontFamily="{StaticResource MDI}" Text="{x:Static m:IconFont.Function}" />
|
||||
</Button>
|
||||
|
||||
<TextBox Grid.Column="2" Text="{Binding InputText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" MinHeight="44"
|
||||
AutomationProperties.Name="Expression input"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue