Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:35
    timunie closed #10225
  • 15:34
    timunie commented #10225
  • 15:28
    tivewsalaeharad commented #10225
  • 15:28
    tivewsalaeharad commented #10225
  • 14:12
    timunie commented #10225
  • 13:54
    jp2masa commented #10225
  • 13:36
    jp2masa labeled #10226
  • 13:36
    jp2masa opened #10226
  • 12:50
    Stannieman commented #8894
  • 12:46
    tivewsalaeharad labeled #10225
  • 12:46
    tivewsalaeharad opened #10225
  • 11:57
    avaloniaui-team commented #10224
  • 11:55
    affederaffe synchronize #9810
  • 11:19
    MrJul opened #10224
  • 11:06
    navhaxs commented #9989
  • 11:05
    navhaxs commented #9989
  • 09:28
    avaloniaui-team commented #10222
  • 09:03
    jp2masa opened #10222
  • 08:16
    jp2masa ready_for_review #10210
  • 07:08
    maxkatz6 closed #10122
.
@avaloniaui:matrix.org
[m]
timunie
wait,
timunie
try IsChecked="{TemplateBinding ShowOption, Mode=TwoWay}
Cole Tobin
@colejohnson66
It's a reactive property:
    private bool _showOptionX;
    public bool ShowOptionX
    {
        get => _showOptionX;
        set => this.RaiseAndSetIfChanged(ref _showOptionX, value);
    }
Two way didn't fix it. It still doesn't fire.
.
@avaloniaui:matrix.org
[m]
timunie
Are you inheriting a UserControl
Cole Tobin
@colejohnson66
I'm using what Rider gave me when I asked for a templated control file: public class OptionTitle : TemplatedControl
.
@avaloniaui:matrix.org
[m]
timunie
that's right
timunie
Are you sure your VM is set?
timunie
Use CompiledBindings if you are not doing so
Cole Tobin
@colejohnson66
I GOT IT
.
@avaloniaui:matrix.org
[m]
timunie
If you have still issues, we need a sample
Cole Tobin
@colejohnson66
I had to use Mode=TwoWay on the actual compiled bindings
.
@avaloniaui:matrix.org
[m]
timunie
what was wrong?
Cole Tobin
@colejohnson66
in addition to inside the control
.
@avaloniaui:matrix.org
[m]
timunie
But you can also make twoway default in StylesProperty
timunie
I don't rembmer the sytax
timunie
In Register I think
Cole Tobin
@colejohnson66
AvaloniaProperty.Register<OptionTitle, bool>(nameof(ShowOption), defaultBindingMode: BindingMode.TwoWay);
It's good now. Thanks for suggesting the binding mode earlier!
I always forget about that
.
@avaloniaui:matrix.org
[m]

Robert
Thanks, I gave this a shot but it was still preventing the textbox from receiving input when I tried it. In any case I solved it now by making the commands unexecutable when that textbox is active. Not ideal and only works for my situation, but atleast it works around my impedement (re @timunie: Robert I found that I can disable parent key bindings if I place another one inside TextBox like:

<Window.KeyBindings>
<KeyBinding Command="{Binding DoSometingCommand}" Gesture="Ctrl+C"></KeyBinding>
</Window.KeyBindings>

<Design.DataContext>
<vm:MainWindowViewModel/>
</Design.DataContext>

<StackPanel>
<TextBox>
<TextBox.KeyBindings>
<KeyBinding Command="{Binding DoNothingCommand}" Gesture="Ctrl+C"></KeyBinding>
</TextBox.KeyBindings>
</TextBox>
<TextBlock Text="{Binding Count}"></TextBlock>
<Button />
</StackPanel>
my ViewModel:
public partial class MainWindowViewModel : ObservableObject
{
[ObservableProperty]
private int _Count;
[RelayCommand]
void DoSometing() => Count++;

[RelayCommand]
void DoNothing(){}

})

Robert
It did prevent the other events from triggering so that did work ^^
.
@avaloniaui:matrix.org
[m]
RazorSharpFang
I don't think I'm going to find a solution to the issue I found earlier. It really looks like without the collection class implementing non-generic IList that there's no good solutions to indexing a collection by integer index that works with both classes and structs being enumerated.
RazorSharpFang
You just have to implement non-generic IList, even if you have all of the mutating methods throw exceptions.
.
@avaloniaui:matrix.org
[m]
timunie
Yeah I made a DoNothingCommand. This can also be a DoSomethingElseCommand where you provide a CommandParameter. But as you now have a solution, I think it's okay. (re @Robert: It did prevent the other events from triggering so that did work ^^)
timunie
I'm not sure if we need a way to support this somehow. So proably worth to open a feature request where this can be discussed further.
timunie
As I wrote in your ticket, also M$ did it that way. So I think it's not Avalonias fault. Anyway, all the Devs I asked agreed with your findings. It just feels like that supporting the interface is a rare case and not worth the pain. (re @RazorSharpFang: You just have to implement non-generic IList, even if you have all of the mutating methods throw exceptions.)
timunie
Just my 2 cents, not a final judgement
.
@avaloniaui:matrix.org
[m]
RazorSharpFang
It looks really difficult to do this without having the Type to be indexed also specified - which has really big implications for the inheritance hierarchy of the classes in question.
I don't know if it's unreasonable to ask for the type to be displayed specified? But that has implications for the IDataTemplate implementors.
🤷‍♂️ (re @timunie: Just my 2 cents, not a final judgement)
RazorSharpFang
Nothing I am able to think of I like.
.
@avaloniaui:matrix.org
[m]
.
@avaloniaui:matrix.org
[m]
RazorSharpFang
Yea 😭
Nothing to do, but implement IList and add a lot of throw statements.
.
@avaloniaui:matrix.org
[m]
Bunny
Do we have a convenient way to apply TextDecorations to all text elements in ContentPresenter?
timunie
Via Styles ?
timunie
You can apply them globally in App.axaml or locally in each node
.
@avaloniaui:matrix.org
[m]
:point_up: Edit: timunie
I'm not sure if we need a way to support this somehow. So proably worth to open a feature request where this can be discussed further.
.
@avaloniaui:matrix.org
[m]
Bunny
Thanks, I want to apply that in a control theme, but with a property as selector to determine whether the decoration should be applied. It's kind hard to implement with style selector. Not really specific to TextDecoration.
Bunny
.
@avaloniaui:matrix.org
[m]
asrulhadi
Hi,
I'm trying to close an avalonia app remotely.
Using Process.CloseMainWindow Method, I could successfully remotely the application on Window. But the method fail to close the application on Linux (manjaro).
Are there any alternative way to close an application on Linux?
RazorSharpFang
Are you okay with it skipping all finally blocks and handlers?
RazorSharpFang
E.g.: Files may be left open, stuff unsaved
asrulhadi
Process.Kill work in Linux, but looking for a better option...
.
@avaloniaui:matrix.org
[m]
Drac
Hi, Is there a Rich Text Editor with HTML support for Avalonia like the DevExpress Rich Text Editor?
https://docs.devexpress.com/WPF/8651/controls-and-libraries/rich-text-editor
.
@avaloniaui:matrix.org
[m]
RazorSharpFang
You may be able to send it signals instead, but then that's probably not cross-platform so you may have to write native code. (re @asrulhadi: Process.Kill work in Linux, but looking for a better option...)
.
@avaloniaui:matrix.org
[m]
SuperJMN
Hey, is there a good and reliable way to know the source of a value of a AvaloniaProperty?
SuperJMN
I'm debugging a case where a FontSize takes a value of 14 where it should be 15
wieslawsoltes
devtools
wieslawsoltes
see active styles