Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 01:32
    SCLD-JBuczkowski commented #2276
  • Feb 19 17:03
    kekekeks commented #3571
  • Feb 19 15:12
    matkoch commented #3571
  • Feb 19 11:13
    aguahombre opened #3591
  • Feb 19 09:18
    grokys commented #3590
  • Feb 19 09:18
    grokys labeled #3590
  • Feb 19 09:18
    grokys opened #3590
  • Feb 19 08:13
    DooblyNoobly commented #3587
  • Feb 19 08:13
    DooblyNoobly commented #3587
  • Feb 19 08:09
    DooblyNoobly commented #3587
  • Feb 19 08:01
    kekekeks commented #3587
  • Feb 19 07:55
    DooblyNoobly commented #3587
  • Feb 19 07:53
    kekekeks commented #3587
  • Feb 19 07:46
    Gillibald commented #3587
  • Feb 19 07:44
    Gillibald commented #3587
  • Feb 19 07:34
    DooblyNoobly commented #3587
  • Feb 19 07:33
    Gillibald commented #3587
  • Feb 19 07:31
    DooblyNoobly commented #3587
  • Feb 19 07:27
    Gillibald commented #3587
  • Feb 19 07:21
    DooblyNoobly commented #3587
K0beBean
@K0beBean
thanks
Nikita Tsukanov
@kekekeks
but we should fix that and allow x:Name
K0beBean
@K0beBean
right, but is there an easier way than doing NativeMenu.GetMenu and finding the Items?
ah ok
Nikita Tsukanov
@kekekeks
Right now there is none, I'm afraid
Hyperyor
@Hyperyor
Hello! I'm starting to use avalonia so I was following the tutorial but when I get to the Creating a View section I get an error with the <views:TodoListView/>. I was wondering if someone would know the problem here
Hyperyor
@Hyperyor
ok I solved it, the problem was, of course, me
Jose C Gomez
@josegomez
hello
quick question, from inside a ViewModel (currently on screen) on a button click I am creating a new instance of MainWindow and displaying it as a Dialog
Like so
MainWindow w = new MainWindow();
                        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>());
that works fine except hew new Window I can't click on it still acts as if the (parent) is on top
image.png
This is the main window when I click ok It uses the above code to fire off another window as a Dialog (on top of this one)
image.png
however it ends up like this
where I can continue to click on the Main Window but my new (dialog) is behind
Jose C Gomez
@josegomez
ha! figured it out. MainWindow() calls
AvaloniaLocator.CurrentMutable.Bind<MainWindow>().ToConstant(this); in its constructor
so the new Window was (somehow) effectively making itself it's owner
not sure that should be allowed but... I fixed it
Nikita Tsukanov
@kekekeks
I think we aren't currently checking for dialog owner loops
Jose C Gomez
@josegomez
right that appears to be the case it allowed me to do it, not a huge deal just a heads up
if you'd like I can open an issue
Steven Kirk
@grokys
Yeah if you could open an issue that would be helpful
Jose C Gomez
@josegomez
RadioButton binding, is there a way to have 2 RadioButtons which each "change" the value of the same binding?
I can't see a Value property on the radio button
Daniel Keenan
@dfkeenan
Aww, I was hoping to change (inherit from) 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.
Daniel Keenan
@dfkeenan
Why is it so hard to create paths. I tried copying the existing paths into InkSkape and rotate them 90 degrees. But kind of horrible. Any better suggestions?
Daniel Keenan
@dfkeenan
Hacks!!
<Path.RenderTransform>
  <RotateTransform Angle="90" />
</Path.RenderTransform>
Daniel Keenan
@dfkeenan
Hmm, all the math IValueConverter (WPF) I can find have the math in the parameter not as the value.
ahopper
@ahopper
they generally apply the maths to the value though
I wonder if it is possible to make something like StringFormat but MathFormat (had to work hard to write American then)
Daniel Keenan
@dfkeenan
image.png
Making some progress I guess.
Daniel Keenan
@dfkeenan
I created my own converter and tried doing Text="{TemplateBinding Text, Converter={x:Static cv:MathExpressionConverter.Instance }}". Not doing what I want though.
Daniel Keenan
@dfkeenan
Hmm, doesn't Avalonia have the equivalent of Binding.UpdateSourceTrigger?
Nikita Tsukanov
@kekekeks
Unfortunately, not
we are always using PropertyChanged policy
Daniel Keenan
@dfkeenan
Is there a way to make it so the TextBox doesn't update until you press enter? I think constantly converting a math expression with every keystroke will be trouble.
Nikita Tsukanov
@kekekeks
You can create a behavior, I guess
And bind your model there
Then you could implement a custom property update logic
Daniel Keenan
@dfkeenan

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.

Benedikt Stebner
@Gillibald
I think number formats can automatically be applied by the text shaping engine
Daniel Keenan
@dfkeenan
I'm not sure if it's because of avalonia or visual studio. But everytime a xaml file is added it makes a bit of a mess of things in the csproj file.
Daniel Keenan
@dfkeenan
Is there a way to tell if a property is bound?
Daniel Keenan
@dfkeenan
Hmm, you can't use WindowIcon as image source?
Daniel Keenan
@dfkeenan
Is there a psuedo for window being active?
OpenMan
@openmandev

@grokys

@openmandev sounds like a bug. could you open an issue with a minimal repro and i'll try to fix it

AvaloniaUI/Avalonia#3468

Daniel Keenan
@dfkeenan
I tried this but get selector errors.
<Style Selector="Window.Metro[IsActive=true] /template/ #Window_Border">
  <Setter Property="BorderBrush" Value="{DynamicResource ThemeAccentBrush}" />
</Style>