Added function in the panel for user to be added new function

This commit is contained in:
Ankitkumar Satapara
2026-04-18 17:24:55 +05:30
parent 21aaef6776
commit 5c838908eb
9 changed files with 454 additions and 8 deletions

View File

@@ -433,6 +433,21 @@
</nodify:Node>
</DataTemplate>
<DataTemplate DataType="{x:Type local:FunctionOperationViewModel}">
<nodify:Node Header="{Binding Title}"
Input="{Binding Input}"
Output="{Binding Output}"
ToolTip="Double click to edit function"
BorderBrush="#FF9800"
BorderThickness="2">
<nodify:Node.InputBindings>
<MouseBinding Gesture="LeftDoubleClick"
Command="{Binding DataContext.OpenCalculatorCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding InnerCalculator}" />
</nodify:Node.InputBindings>
</nodify:Node>
</DataTemplate>
<DataTemplate DataType="{x:Type local:CalculatorOperationViewModel}">
<nodify:Node Header="{Binding Title}"
Input="{Binding Input}"
@@ -691,6 +706,38 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Functions Section -->
<TextBlock Text="Functions" FontWeight="Bold" Margin="0 8 0 4" />
<Button Content=" Create New Function"
Command="{Binding Calculator.OperationsMenu.CreateFunctionCommand}"
Margin="0 0 0 6"
Padding="6 3"
Cursor="Hand"
Background="#FF9800"
Foreground="White" />
<ItemsControl ItemsSource="{Binding Calculator.OperationsMenu.AvailableFunctions}"
Focusable="False">
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="FrameworkElement.Margin" Value="3" />
<Setter Property="FrameworkElement.HorizontalAlignment" Value="Left" />
<Setter Property="FrameworkElement.Cursor" Value="Hand" />
<Setter Property="FrameworkElement.ToolTip" Value="Drag and drop to add this function to the flow" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type local:OperationInfoViewModel}">
<Border Background="#3E3E42" CornerRadius="3" Padding="6 4"
MouseMove="OnNodeDrag" Cursor="Hand">
<StackPanel Orientation="Horizontal">
<TextBlock Text="ƒ " Foreground="#FF9800" FontWeight="Bold" />
<TextBlock Text="{Binding Title}" Foreground="Orange" FontWeight="SemiBold" />
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
</DockPanel>