These are chat archives for AvaloniaUI/Avalonia

10th
Jan 2019
Benedikt Schroeder
@Gillibald
Jan 10 08:14
I love Span<T> and Memory<T> so much. These help a lot to avoid using sub strings.
This is the most fun thing:
var text = "ABCDEF";
var memory = text.AsMemory();

using(var handle = memory.Pin())
{
    SomeNativeMethod(handle.Pointer);
    // or
    SomeNativeMethod((char*)handle.Pointer);
}
Nikita Tsukanov
@kekekeks
Jan 10 08:20
Can't be used for handling unmanaged memory areas, unfortunately
Would be really nice to be able to call Stream.ReadAsync to some unmanaged pointer region
Benedikt Schroeder
@Gillibald
Jan 10 08:22
Isn't a custom MemoryManager<T> ment for that scenario?
Nikita Tsukanov
@kekekeks
Jan 10 08:26
Memory is always backed by a managed object, unfortunately
I might be wrong though
Hmmm
The corresponding ctor is internal though
I've misinterpreted CreateMemory method
We need to refactor our UnmanagedBlob to inherit from MemoryManager then
Benedikt Schroeder
@Gillibald
Jan 10 11:03
Inlines.PNG
ahopper
@ahopper
Jan 10 11:05
:+1: looking good
Benedikt Schroeder
@Gillibald
Jan 10 11:08
Had to use a RenderTargetBitmap to draw it without merging in the inlines PR
Is there a reason I can't set FormattedText on a TextBlock etc?
Now we have to wait until my SkiaSharp additions get released. Or change some part s to the old version hmm.
Nikita Tsukanov
@kekekeks
Jan 10 11:35
SkiaSharp or harfbuzz?
We can publish a patched package with managed library changes to our myget feed
Benedikt Schroeder
@Gillibald
Jan 10 11:53
I have updated the native build of HarfBuzz and have introduced changes to HarfBuzzSharp and SkiaSharp.HarfBuzz
We don't need a updated version of HarfBuzz so the managed parts would be enough.
Don't see any native build changes there
We can just rebuild managed parts and be fine
Benedikt Schroeder
@Gillibald
Jan 10 14:53
👍Native changes have a different branch
Nikita Tsukanov
@kekekeks
Jan 10 15:16
Where?
Are you sure that native code changes are needed?
Benedikt Schroeder
@Gillibald
Jan 10 15:21
They are not needed for now. There are no ABI changes so everything should work with the old version. Sry for the confusion.
Eliot Jones
@EliotJones
Jan 10 21:15

sorry for the really beginner question. If I have a textbox on a Window in the MVVM project template app:

 <TextBox Width="250" Height="30" Text="{Binding Value}"></TextBox>

And then the property on the MainWindowViewModel.cs inserts a "£" character every time that value is updated:

private string textValue;
    public string Value
    {
        get => textValue;
        set => this.RaiseAndSetIfChanged(ref textValue, value + "£");
    }

Why don't I see the value being updated in the textbox (if I bind the same property to a textblock it gets updated with a £ on the end but this is overwritten on the next change)? This is probably something I could work out myself if there's a more fleshed out MVVM example somewhere, preferably one with UserControls too

Steven Kirk
@grokys
Jan 10 22:13
i think it's because the textbox expects the value written to the property to be the value the property will have after the write
if that makes sense
and if i understand the q properly
though it is raising the property changed event, so that might not be it...