Compare commits
No commits in common. "7e40c1dc0bb878a1c4d7ded75867e01b15ae236b" and "f8c1ef0e96771b3561395c1e94ab63df40a57110" have entirely different histories.
7e40c1dc0b
...
f8c1ef0e96
10 changed files with 80 additions and 372 deletions
|
|
@ -1,17 +0,0 @@
|
||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<!-- Android overrides: larger, touch-first -->
|
|
||||||
<x:Double x:Key="FontSizeBase">16</x:Double>
|
|
||||||
<x:Double x:Key="FontSizeLarge">18</x:Double>
|
|
||||||
<x:Double x:Key="IconSizeM">24</x:Double>
|
|
||||||
<x:Double x:Key="LineHeightBase">1.35</x:Double>
|
|
||||||
|
|
||||||
<!-- Thin overlay-like scrollbars -->
|
|
||||||
<Style Selector="ScrollBar:vertical">
|
|
||||||
<Setter Property="Width" Value="8"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ScrollBar:horizontal">
|
|
||||||
<Setter Property="Height" Value="8"/>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<!-- Browser overrides: middle ground -->
|
|
||||||
<x:Double x:Key="FontSizeBase">15</x:Double>
|
|
||||||
<x:Double x:Key="IconSizeM">22</x:Double>
|
|
||||||
<x:Double x:Key="LineHeightBase">1.3</x:Double>
|
|
||||||
|
|
||||||
<!-- Slightly thinner scrollbars on web -->
|
|
||||||
<Style Selector="ScrollBar:vertical">
|
|
||||||
<Setter Property="Width" Value="8"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ScrollBar:horizontal">
|
|
||||||
<Setter Property="Height" Value="8"/>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<!-- Desktop overrides: slightly denser -->
|
|
||||||
<x:Double x:Key="FontSizeBase">13</x:Double>
|
|
||||||
<x:Double x:Key="LineHeightBase">1.2</x:Double>
|
|
||||||
<x:Double x:Key="IconSizeM">20</x:Double>
|
|
||||||
|
|
||||||
<!-- Scrollbars a bit thicker on desktop -->
|
|
||||||
<Style Selector="ScrollBar:vertical">
|
|
||||||
<Setter Property="Width" Value="12"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ScrollBar:horizontal">
|
|
||||||
<Setter Property="Height" Value="12"/>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
|
|
||||||
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<FluentTheme />
|
<FluentTheme />
|
||||||
<StyleInclude Source="avares://AdvancedCalculator/Styles/Typography.axaml"/>
|
|
||||||
<StyleInclude Source="avares://AdvancedCalculator/Styles/Scroll.axaml"/>
|
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
|
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ using Avalonia;
|
||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Data.Core.Plugins;
|
using Avalonia.Data.Core.Plugins;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using Avalonia.Styling;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace AdvancedCalculator;
|
namespace AdvancedCalculator;
|
||||||
|
|
||||||
|
|
@ -23,40 +21,6 @@ public partial class App : Application
|
||||||
// Without this line you will get duplicate validations from both Avalonia and CT
|
// Without this line you will get duplicate validations from both Avalonia and CT
|
||||||
BindingPlugins.DataValidators.RemoveAt(0);
|
BindingPlugins.DataValidators.RemoveAt(0);
|
||||||
|
|
||||||
// Load platform-specific styles (typography, scrollbars overrides)
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var styles = Current?.Styles;
|
|
||||||
if (styles is not null)
|
|
||||||
{
|
|
||||||
if (OperatingSystem.IsAndroid())
|
|
||||||
{
|
|
||||||
styles.Add(new StyleInclude(new Uri("avares://AdvancedCalculator/"))
|
|
||||||
{
|
|
||||||
Source = new Uri("avares://AdvancedCalculator.Android/Styles/Android.axaml")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (OperatingSystem.IsBrowser())
|
|
||||||
{
|
|
||||||
styles.Add(new StyleInclude(new Uri("avares://AdvancedCalculator/"))
|
|
||||||
{
|
|
||||||
Source = new Uri("avares://AdvancedCalculator.Browser/Styles/Browser.axaml")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
styles.Add(new StyleInclude(new Uri("avares://AdvancedCalculator/"))
|
|
||||||
{
|
|
||||||
Source = new Uri("avares://AdvancedCalculator.Desktop/Styles/Desktop.axaml")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// If a platform-specific style dictionary is missing, continue without failing.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||||
{
|
{
|
||||||
desktop.MainWindow = new MainWindow
|
desktop.MainWindow = new MainWindow
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
|
|
||||||
namespace AdvancedCalculator.Converters;
|
|
||||||
|
|
||||||
// Returns true if width (double) is less than the provided threshold (parameter),
|
|
||||||
// otherwise false. Default threshold is 640 when parameter is null or invalid.
|
|
||||||
public class WidthToBooleanConverter : IValueConverter
|
|
||||||
{
|
|
||||||
public static readonly WidthToBooleanConverter Instance = new();
|
|
||||||
|
|
||||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo? culture)
|
|
||||||
{
|
|
||||||
if (value is double width)
|
|
||||||
{
|
|
||||||
double threshold = 640;
|
|
||||||
if (parameter is double p)
|
|
||||||
threshold = p;
|
|
||||||
else if (parameter is string s && double.TryParse(s, NumberStyles.Number, CultureInfo.InvariantCulture, out var parsed))
|
|
||||||
threshold = parsed;
|
|
||||||
|
|
||||||
return width < threshold;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo? culture)
|
|
||||||
=> throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<!-- Shared scrolling defaults -->
|
|
||||||
<Style Selector="ListBox">
|
|
||||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
|
||||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<Style Selector="ScrollViewer">
|
|
||||||
<Setter Property="CanScrollHorizontally" Value="False"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!-- Thin-ish scrollbars by default; platform overrides will adjust -->
|
|
||||||
<Style Selector="ScrollBar:vertical">
|
|
||||||
<Setter Property="Width" Value="10"/>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="ScrollBar:horizontal">
|
|
||||||
<Setter Property="Height" Value="10"/>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
||||||
<!-- Shared typography resources -->
|
|
||||||
<x:Double x:Key="FontSizeSmall">12</x:Double>
|
|
||||||
<x:Double x:Key="FontSizeBase">14</x:Double>
|
|
||||||
<x:Double x:Key="FontSizeLarge">16</x:Double>
|
|
||||||
<x:Double x:Key="FontSizeXL">20</x:Double>
|
|
||||||
|
|
||||||
<x:Double x:Key="IconSizeS">18</x:Double>
|
|
||||||
<x:Double x:Key="IconSizeM">22</x:Double>
|
|
||||||
<x:Double x:Key="IconSizeL">26</x:Double>
|
|
||||||
|
|
||||||
<x:Double x:Key="LineHeightTight">1.1</x:Double>
|
|
||||||
<x:Double x:Key="LineHeightBase">1.25</x:Double>
|
|
||||||
<x:Double x:Key="LineHeightRelaxed">1.4</x:Double>
|
|
||||||
|
|
||||||
<!-- Defaults for text -->
|
|
||||||
<Style Selector="TextBlock">
|
|
||||||
<Setter Property="TextElement.FontSize" Value="{DynamicResource FontSizeBase}"/>
|
|
||||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
|
||||||
<Setter Property="LineHeight" Value="{DynamicResource LineHeightBase}"/>
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!-- Subtle caption text helper -->
|
|
||||||
<Style Selector="TextBlock.caption">
|
|
||||||
<Setter Property="TextElement.FontSize" Value="{DynamicResource FontSizeSmall}"/>
|
|
||||||
<Setter Property="Opacity" Value="0.85"/>
|
|
||||||
</Style>
|
|
||||||
</ResourceDictionary>
|
|
||||||
|
|
||||||
|
|
@ -41,37 +41,6 @@ public partial class MainViewModel : ViewModelBase
|
||||||
IsFunctionsPanelOpen = !IsFunctionsPanelOpen;
|
IsFunctionsPanelOpen = !IsFunctionsPanelOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert helpers for touch: appends tokens to the input box
|
|
||||||
[RelayCommand]
|
|
||||||
private void InsertVariable(string? variableName)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(variableName))
|
|
||||||
return;
|
|
||||||
InsertToken(variableName);
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void InsertFunction(string? functionName)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(functionName))
|
|
||||||
return;
|
|
||||||
InsertToken(functionName + "()");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InsertToken(string token)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(InputText))
|
|
||||||
{
|
|
||||||
InputText = token;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!char.IsWhiteSpace(InputText[^1]))
|
|
||||||
InputText += " ";
|
|
||||||
|
|
||||||
InputText += token;
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand(AllowConcurrentExecutions = false)]
|
[RelayCommand(AllowConcurrentExecutions = false)]
|
||||||
private async Task Submit()
|
private async Task Submit()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,184 +10,92 @@
|
||||||
x:DataType="vm:MainViewModel">
|
x:DataType="vm:MainViewModel">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<conv:BoolToGridLengthConverter x:Key="BoolToGridLengthConverter" />
|
<conv:BoolToGridLengthConverter x:Key="BoolToGridLengthConverter" />
|
||||||
<conv:WidthToBooleanConverter x:Key="WidthToBooleanConverter" />
|
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!-- Replace columns with a responsive SplitView -->
|
|
||||||
<SplitView x:Name="RootSplit"
|
|
||||||
OpenPaneLength="320"
|
|
||||||
CompactPaneLength="0">
|
|
||||||
<!-- Responsive behavior: set DisplayMode and IsPaneOpen based on width -->
|
|
||||||
<SplitView.Styles>
|
|
||||||
<Style Selector="SplitView#RootSplit">
|
|
||||||
<Style.Triggers>
|
|
||||||
<!-- Narrow: Overlay mode, pane closed by default -->
|
|
||||||
<DataTrigger Value="True"
|
|
||||||
Binding="{Binding $parent[Window].Bounds.Width,
|
|
||||||
Converter={StaticResource WidthToBooleanConverter},
|
|
||||||
ConverterParameter=640}">
|
|
||||||
<Setter Property="DisplayMode" Value="Overlay" />
|
|
||||||
<Setter Property="IsPaneOpen" Value="False" />
|
|
||||||
</DataTrigger>
|
|
||||||
<!-- Wide: Inline mode, pane open -->
|
|
||||||
<DataTrigger Value="False"
|
|
||||||
Binding="{Binding $parent[Window].Bounds.Width,
|
|
||||||
Converter={StaticResource WidthToBooleanConverter},
|
|
||||||
ConverterParameter=640}">
|
|
||||||
<Setter Property="DisplayMode" Value="Inline" />
|
|
||||||
<Setter Property="IsPaneOpen" Value="True" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</SplitView.Styles>
|
|
||||||
|
|
||||||
<!-- Left pane: Variables + Functions -->
|
<Grid ColumnDefinitions="*,3*">
|
||||||
<SplitView.Pane>
|
<!-- Left column: Variables + Functions -->
|
||||||
<Grid>
|
<Grid Grid.Column="0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="{Binding IsFunctionsPanelOpen, Converter={StaticResource BoolToGridLengthConverter}}" />
|
<RowDefinition Height="{Binding IsFunctionsPanelOpen, Converter={StaticResource BoolToGridLengthConverter}}" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Variables list with empty-state hint overlay -->
|
<!-- Variables list -->
|
||||||
<Grid Grid.Row="0">
|
<ListBox Grid.Row="0" ItemsSource="{Binding Variables}" SelectedIndex="-1">
|
||||||
<ListBox ItemsSource="{Binding Variables}" SelectedIndex="-1" HorizontalContentAlignment="Stretch"
|
<ListBox.ItemTemplate>
|
||||||
AutomationProperties.Name="Variables list">
|
<DataTemplate x:DataType="m:VariableItem">
|
||||||
<ListBox.ItemTemplate>
|
<Grid ColumnDefinitions="Auto,*,Auto" Margin="4,2">
|
||||||
<DataTemplate x:DataType="m:VariableItem">
|
<TextBlock Grid.Column="0" FontFamily="{StaticResource MDI}"
|
||||||
<Button Command="{Binding DataContext.InsertVariableCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
FontSize="22" Text="{Binding Icon}" VerticalAlignment="Center" Margin="0,0,8,0" />
|
||||||
CommandParameter="{Binding VariableName}"
|
<TextBlock Grid.Column="1" Text="{Binding VariableName}" FontWeight="Bold" VerticalAlignment="Center" />
|
||||||
Background="Transparent" BorderThickness="0" Padding="8" MinHeight="44"
|
<StackPanel Grid.Column="2" Spacing="2">
|
||||||
AutomationProperties.Name="Insert variable">
|
<TextBlock Text="{Binding Value}" />
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto">
|
<TextBlock IsVisible="{Binding IsExpression}" Text="{Binding ExpressionComputation}" FontStyle="Italic" />
|
||||||
<TextBlock Grid.Column="0" FontFamily="{StaticResource MDI}"
|
</StackPanel>
|
||||||
FontSize="{DynamicResource IconSizeM}" Text="{Binding Icon}" VerticalAlignment="Center" Margin="0,0,8,0" />
|
</Grid>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding VariableName}" FontWeight="Bold" VerticalAlignment="Center" />
|
</DataTemplate>
|
||||||
<StackPanel Grid.Column="2" Spacing="6" VerticalAlignment="Center">
|
</ListBox.ItemTemplate>
|
||||||
<TextBlock Text="{Binding Value}" />
|
</ListBox>
|
||||||
<TextBlock IsVisible="{Binding IsExpression}" Text="{Binding ExpressionComputation}" FontStyle="Italic" />
|
|
||||||
|
<!-- Function definitions -->
|
||||||
|
<ListBox Grid.Row="1" BorderThickness="0"
|
||||||
|
ItemsSource="{x:Static m:FunctionDefinitionItem.DefinedFunctions}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate x:DataType="m:FunctionDefinitionItem">
|
||||||
|
<StackPanel Spacing="2" Margin="4,6">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||||
|
<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>
|
</StackPanel>
|
||||||
</Grid>
|
</DataTemplate>
|
||||||
</Button>
|
</ItemsControl.ItemTemplate>
|
||||||
</DataTemplate>
|
</ItemsControl>
|
||||||
</ListBox.ItemTemplate>
|
</StackPanel>
|
||||||
</ListBox>
|
</DataTemplate>
|
||||||
<TextBlock Text="No variables yet. Define with: x = 5"
|
</ListBox.ItemTemplate>
|
||||||
IsVisible="False"
|
</ListBox>
|
||||||
IsHitTestVisible="False"
|
</Grid>
|
||||||
Opacity="0.6"
|
|
||||||
HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
<TextBlock.Styles>
|
|
||||||
<Style Selector="TextBlock">
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding Variables.Count}" Value="0">
|
|
||||||
<Setter Property="IsVisible" Value="True" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</TextBlock.Styles>
|
|
||||||
</TextBlock>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!-- Function definitions -->
|
<!-- GridSplitter between columns -->
|
||||||
<ListBox Grid.Row="1" BorderThickness="0" HorizontalContentAlignment="Stretch"
|
<GridSplitter Grid.Column="0" HorizontalAlignment="Right" Width="5" Background="Transparent" />
|
||||||
ItemsSource="{x:Static m:FunctionDefinitionItem.DefinedFunctions}"
|
|
||||||
AutomationProperties.Name="Functions list">
|
<!-- Right column: History + Input -->
|
||||||
<ListBox.ItemTemplate>
|
<Grid Grid.Column="1" RowDefinitions="*,Auto">
|
||||||
<DataTemplate x:DataType="m:FunctionDefinitionItem">
|
<!-- History -->
|
||||||
<Button Command="{Binding DataContext.InsertFunctionCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
<ListBox Grid.Row="0" ItemsSource="{Binding History}" SelectedIndex="{Binding SelectedHistoryIndex}">
|
||||||
CommandParameter="{Binding FunctionName}"
|
<ListBox.ItemTemplate>
|
||||||
Background="Transparent" BorderThickness="0" Padding="8" MinHeight="44"
|
<DataTemplate x:DataType="m:HistoryItem">
|
||||||
AutomationProperties.Name="Insert function">
|
<Grid ColumnDefinitions="Auto,*" Margin="4,2">
|
||||||
<StackPanel Spacing="8">
|
<TextBlock FontFamily="{StaticResource MDI}" Text="{x:Static m:IconFont.ArrowRightDropCircle}"
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
|
FontSize="22" VerticalAlignment="Center" Margin="0,0,8,0" />
|
||||||
<TextBlock FontFamily="{StaticResource MDI}" Text="{Binding Icon}" />
|
<StackPanel Grid.Column="1">
|
||||||
<TextBlock Text="{Binding FunctionName}" FontWeight="Bold" />
|
<TextBlock Text="{Binding Input}" />
|
||||||
</StackPanel>
|
<TextBlock Text="{Binding Output}" FontWeight="Bold" />
|
||||||
<TextBlock Text="{Binding FunctionDescription}" FontStyle="Italic" TextWrapping="Wrap" />
|
</StackPanel>
|
||||||
<ItemsControl ItemsSource="{Binding FunctionArguments}">
|
</Grid>
|
||||||
<ItemsControl.ItemTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate>
|
</ListBox.ItemTemplate>
|
||||||
<StackPanel>
|
</ListBox>
|
||||||
<TextBlock Text="{Binding Key}" />
|
|
||||||
<TextBlock Text="{Binding Value}" FontStyle="Italic" Margin="8,0,0,0" />
|
<!-- Input Row -->
|
||||||
</StackPanel>
|
<Grid Grid.Row="1" ColumnDefinitions="Auto,*" Margin="4">
|
||||||
</DataTemplate>
|
<Button Command="{Binding ToggleFunctionsCommand}" Margin="0,0,6,0">
|
||||||
</ItemsControl.ItemTemplate>
|
<TextBlock FontFamily="{StaticResource MDI}" Text="{x:Static m:IconFont.Function}" />
|
||||||
</ItemsControl>
|
</Button>
|
||||||
</StackPanel>
|
<TextBox Grid.Column="1" Text="{Binding InputText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||||
</Button>
|
<InputElement.KeyBindings>
|
||||||
</DataTemplate>
|
<KeyBinding Gesture="Enter" Command="{Binding SubmitCommand}" />
|
||||||
</ListBox.ItemTemplate>
|
</InputElement.KeyBindings>
|
||||||
</ListBox>
|
</TextBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</SplitView.Pane>
|
</Grid>
|
||||||
|
</Grid>
|
||||||
<!-- Right content: History + Input -->
|
|
||||||
<SplitView.Content>
|
|
||||||
<Grid RowDefinitions="*,Auto">
|
|
||||||
<!-- History -->
|
|
||||||
<Grid Grid.Row="0">
|
|
||||||
<ListBox ItemsSource="{Binding History}" SelectedIndex="{Binding SelectedHistoryIndex}"
|
|
||||||
AutomationProperties.Name="History list">
|
|
||||||
<ListBox.ItemTemplate>
|
|
||||||
<DataTemplate x:DataType="m:HistoryItem">
|
|
||||||
<Grid ColumnDefinitions="Auto,*" Margin="4,2">
|
|
||||||
<TextBlock FontFamily="{StaticResource MDI}" Text="{x:Static m:IconFont.ArrowRightDropCircle}"
|
|
||||||
FontSize="{DynamicResource IconSizeM}" VerticalAlignment="Center" Margin="0,0,8,0" />
|
|
||||||
<StackPanel Grid.Column="1">
|
|
||||||
<TextBlock Text="{Binding Input}" MaxLines="3" />
|
|
||||||
<TextBlock Text="{Binding Output}" FontWeight="Bold" MaxLines="2" />
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</DataTemplate>
|
|
||||||
</ListBox.ItemTemplate>
|
|
||||||
</ListBox>
|
|
||||||
<TextBlock Text="No history yet. Enter an expression and Evaluate."
|
|
||||||
IsVisible="False"
|
|
||||||
IsHitTestVisible="False"
|
|
||||||
Opacity="0.6"
|
|
||||||
HorizontalAlignment="Center" VerticalAlignment="Center">
|
|
||||||
<TextBlock.Styles>
|
|
||||||
<Style Selector="TextBlock">
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding History.Count}" Value="0">
|
|
||||||
<Setter Property="IsVisible" Value="True" />
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</TextBlock.Styles>
|
|
||||||
</TextBlock>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<!-- Input Row -->
|
|
||||||
<Grid Grid.Row="1" ColumnDefinitions="Auto,Auto,*,Auto" Margin="4" ColumnSpacing="6">
|
|
||||||
<!-- Pane toggle: visible on narrow only -->
|
|
||||||
<ToggleButton Margin="0,0,6,0"
|
|
||||||
IsVisible="{Binding $parent[Window].Bounds.Width,
|
|
||||||
Converter={StaticResource WidthToBooleanConverter},
|
|
||||||
ConverterParameter=640}"
|
|
||||||
IsChecked="{Binding #RootSplit.IsPaneOpen}"
|
|
||||||
AutomationProperties.Name="Open side panel">
|
|
||||||
<TextBlock Text="≡" FontSize="18"/>
|
|
||||||
</ToggleButton>
|
|
||||||
|
|
||||||
<!-- Toggle functions panel inside the pane -->
|
|
||||||
<Button Grid.Column="1" Command="{Binding ToggleFunctionsCommand}" Margin="0,0,6,0" MinHeight="40" MinWidth="40"
|
|
||||||
AutomationProperties.Name="Toggle functions panel">
|
|
||||||
<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"
|
|
||||||
Watermark="Type an expression (e.g., 2 + 2)"/>
|
|
||||||
|
|
||||||
<!-- Explicit evaluate button for touch -->
|
|
||||||
<Button Grid.Column="3" Command="{Binding SubmitCommand}" MinHeight="44" Padding="16,8"
|
|
||||||
AutomationProperties.Name="Evaluate">
|
|
||||||
<TextBlock Text="Evaluate"/>
|
|
||||||
</Button>
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</SplitView.Content>
|
|
||||||
</SplitView>
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue