Gillibald on master
Calling default constructor of … Merge branch 'master' into fixe… Merge pull request #5577 from a… (compare)
grokys on ui-automation
var mwTemp = new MainWindowViewModel(this.sqrlInstance);
w.DataContext = mwTemp;
w.WindowStartupLocation = Avalonia.Controls.WindowStartupLocation.CenterOwner;
mwTemp.Content = new AskViewModel(this.sqrlInstance, this.Identity, serverResponse);
await w.ShowDialog(AvaloniaLocator.Current.GetService<MainWindow>());
NumericUpDown
and add a "Small Increment". Somethings are private though. So might have to copy the code and create a new one. My goal is to have a numeric textbox like in Blender: buttons either side of input; click and drag to increment/decrement; use a key modifier to use small increment; be able to do basic math.
So I changed the TextBox.Text
binding in my NumericUpDown
template to {TemplateBinding Text, Converter={x:Static cv:MathExpressionConverter.Instance }, Mode=TwoWay}
. And made my converter like so:
public class MathExpressionConverter : IValueConverter
{
public static readonly MathExpressionConverter Instance = new MathExpressionConverter();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string input && MathExpressionParser.TryParseExpression(input, out var expression))
{
return expression.Compile().Invoke().ToString();
}
return new BindingNotification(new Exception("Invalid expression."), BindingErrorType.DataValidationError);
}
}
And I pretty much get what I want. It does the calculation without clearing the expression and when you press enter it commits the answer and displays the result. IDK how that works.
@grokys
@openmandev sounds like a bug. could you open an issue with a minimal repro and i'll try to fix it