These are chat archives for AvaloniaUI/Avalonia

27th
Feb 2018
danwalmsley
@danwalmsley
Feb 27 2018 11:20
@grokys I have a control that inherits TemplatedControl, and its placed inside a tab control, often when I switch tabs and then go back the Background property changes colour
in the F12 diagnostics, it says value is TemplatedParent, does this mean its inheriting?
how do I stop it inheriting TemplatedParent value?
danwalmsley
@danwalmsley
Feb 27 2018 11:34
hmm i think its when I do a resource change
because the tab isnt selected its hidden and resources don't get applied correctly
Steven Kirk
@grokys
Feb 27 2018 12:00
hmm, i was going to say "don't use TabControl" because it seems everyone has problems with it, but sounds like this isn't TabControl's problem
when you say "placed inside a tab control", you mean in the tab control content part, not header right?
danwalmsley
@danwalmsley
Feb 27 2018 12:01
i was a bit misleading (carousel and tabstrip)
not actual tab control
yes the content...
I think iv narrowed it down a bit
I manually add a control inside ontemplateapplied
and its this that doesn't get the background applied from the parent
that's done like this...
protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);
            ScrollViewer = (ScrollViewer)e.NameScope.Find("PART_ScrollViewer");
            ScrollViewer.Content = TextArea;
so I think i need some code there to bind the TextArea.Background to this.Background
but I cant remember syntax to do that in c#
Steven Kirk
@grokys
Feb 27 2018 12:05

in the F12 diagnostics, it says value is TemplatedParent, does this mean its inheriting?

what is the actual value of TextArea.Background?

danwalmsley
@danwalmsley
Feb 27 2018 12:06
1 sec
now its LocalValue
danwalmsley
@danwalmsley
Feb 27 2018 12:11
once I trigger the bug its 0xFFFFFFFF
I don't see how its getting changed because:
I have <Setter Property="Background" Value="Transparent" /> in the template now
it only happens when I change the global resource...
Application.Current.Resources["ThemeBackgroundBrush"] = theme.Background;
Steven Kirk
@grokys
Feb 27 2018 12:14
hmm ok, i have no idea what's happening ;)
a minimal repro, as always would be really useful
danwalmsley
@danwalmsley
Feb 27 2018 12:15
whats the syntax for binding 2 properties in c# again?
i'll have a look into a repro
hopefully control catalog can show it up
basically, the easiest way is like:
textBlock2[!TextBlock.TextProperty] = textBlock1[!TextBlock.TextProperty];
danwalmsley
@danwalmsley
Feb 27 2018 12:16
thanks
Steven Kirk
@grokys
Feb 27 2018 12:17
i would like to know what's causing it though
could you do a screenshot of the devtools hovering your mouse over the property label when it's incorrect?
danwalmsley
@danwalmsley
Feb 27 2018 12:20
ok I found it!
it was a stupid mistake on my part (yet again) :smile:
basically id done this where id consumed the control in UserControl
<CodeEditor Background="{DynamicResource ThemeEditorBackground}">
then id been trying to have the Background property set inside the CodeEditor in code (to obey colour scheme)
but obviously it was just getting overridden everytime resources were changed
so I'm pretty sure that's what it was
Steven Kirk
@grokys
Feb 27 2018 12:22
ah ok :D
danwalmsley
@danwalmsley
Feb 27 2018 12:23
thanks for helping me though, I noticed as soon as I was looking what i needed for minimal repro!
Steven Kirk
@grokys
Feb 27 2018 12:25
yeah, that's often the way!
Matthijs ter Woord
@mterwoord
Feb 27 2018 12:29
9 times out of 10, when i start reproducing my issue ina simple project, i find what i'm doing wrong.. :)
ahopper
@ahopper
Feb 27 2018 17:11
Hi, I've been playing with WritableBitmap, if I update it fast I get tearing, I guess something is reading as I'm writing. Using two bitmaps and flipping between them stops the tearing. Is it possible to avoid the tearing with a single bitmap or can I minimize the chance by triggering the update off something?
danwalmsley
@danwalmsley
Feb 27 2018 17:12
did you call lock on it?
to get the pixel data
ahopper
@ahopper
Feb 27 2018 17:12
yep
Nikita Tsukanov
@kekekeks
Feb 27 2018 17:37
Are you using Skia backend? No actual locking is implemented there yet
I kinda forgot about it at the moment
ahopper
@ahopper
Feb 27 2018 17:38
netcore on windows
I'm really just trying to get some idea of best practice to continuously update an image.
Performance is pretty good
Nikita Tsukanov
@kekekeks
Feb 27 2018 17:44
Our render probably isn't locking the image properly
Please, file an issue, preferably with a small repro
ahopper
@ahopper
Feb 27 2018 17:49
ok, but I wonder if locking might cause performance issues. WriteableBitmaps seem to have a history of being tricky.
Jonas Jermann
@jjermann
Feb 27 2018 22:06
I'm having trouble to get Oxyplot.Avalonia working with netstandard2.0, I checked out Oxyplot.Avalonia from https://github.com/AvaloniaUI/oxyplot-avalonia.git but it seems to be incompatible with my other installed oxyplot libraries (e.g. a BoundsTracker from Oxyplot.Avalonia.VisualTree is reference which doesn't seem to exist(?)), the easiest way would be to have a nuget package for netstandard2.0 on nuget.org or myget.org (compatible with the other oxyplot/avalonia packages), any other ideas?
hi
danwalmsley
@danwalmsley
Feb 27 2018 22:14
@jkoritzinsky did the port, hopefully he is around
Jeremy Koritzinsky
@jkoritzinsky
Feb 27 2018 22:16
The oxyplot bindings are slightly out of date.
Nikita Tsukanov
@kekekeks
Feb 27 2018 22:16
I've updated them several months ago
AvaloniaUI/oxyplot-avalonia@eb28f29
Jeremy Koritzinsky
@jkoritzinsky
Feb 27 2018 22:16
Perfect 👌
Thanks!
Nikita Tsukanov
@kekekeks
Feb 27 2018 22:16
They aren't packaged on nuget though
Jeremy Koritzinsky
@jkoritzinsky
Feb 27 2018 22:17
Did you send a PR with the updates back to the oxyplot repo yet?
Nikita Tsukanov
@kekekeks
Feb 27 2018 22:17
nope
I was trying to fix animations on GTK
Right now I got them working smoothly
but they block user input
for some reason
There was also an issue with loading the assembly at the right time
For some reason something is broken with assembly scan
Might be our issue or and issue in portablexaml
Jonas Jermann
@jjermann
Feb 27 2018 22:23
I still get the following error:
An exception of type 'System.TypeLoadException' occurred in OxyPlot.Avalonia.dll but was not handled in user code: 'Could not load type 'Avalonia.VisualTree.BoundsTracker' from assembly 'Avalonia.Visuals, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'.'
at OxyPlot.Avalonia.PlotBase..ctor() in /usr/local/src/oxyplot-avalonia/Source/OxyPlot.Avalonia/PlotBase.cs:line 101
at OxyPlot.Avalonia.PlotView..ctor() in /usr/local/src/oxyplot-avalonia/Source/OxyPlot.Avalonia/PlotView.cs:line 33
maybe BoundsTracker was removed or something?
Nikita Tsukanov
@kekekeks
Feb 27 2018 22:28
It wasn't updated to beta, it seems
Jonas Jermann
@jjermann
Feb 27 2018 22:31
can I show a pdf/svg by some other means in avalonia?
danwalmsley
@danwalmsley
Feb 27 2018 22:31
@grokys is horizontal logical scrolling implemented?
Steven Kirk
@grokys
Feb 27 2018 22:31
yeah, it is
you can see it in the VirtualizationTest sample
danwalmsley
@danwalmsley
Feb 27 2018 22:33
ok thanks
just wanted to check that I wasn't trying to debug something that wasn't there
Nikita Tsukanov
@kekekeks
Feb 27 2018 22:40
@jjermann updated to use TransformedBounds
PDF/SVG is not implemented
Direct2D backend might be able to load svg though
Jonas Jermann
@jjermann
Feb 27 2018 22:47
An exception of type 'System.Reflection.TargetInvocationException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Exception has been thrown by the target of an invocation.'
Inner exceptions found, see $exception in variables window for more details.
Innermost exception System.TypeLoadException : Could not load type 'Avalonia.VisualTree.BoundsTracker' from assembly 'Avalonia.Visuals, Version=0.6.0.0, Culture=neutral, PublicKeyToken=null'.
the message slightly changed :)
now it's in System.Private.CoreLib.dll instead of OxyPlot.Avalonia.dll, probably I'm missing something trivial or it's just a version missmatch...
I'll have a closer look at the examples...
Darren Oster
@daggmano
Feb 27 2018 23:31
Hey all, I'm sure this has been covered somewhere, but I don't seem to be able to find it anywhere. I'm just starting out with Avalonia, using the Pizzeria sample as a base, but don't seem to be able to find how to then navigate to a different page. I presume it is by setting CurrentPage on the MainWindowViewModel to a new VM, but how do I get a reference to the MainWindowViewModel instance from another VM? Or should I be setting up delegates to pass through to child VMs, etc? Any samples out there for this?
Jonas Jermann
@jjermann
Feb 27 2018 23:42
you could make a combobox where the page is the selected item or something like that (I assume it's also possible in avalonia)...
you could get the list from e.g. reflection or by other means, these are not that avalonia specific...
or have one main vm that loads the others...