These are chat archives for AvaloniaUI/Avalonia

28th
Sep 2017
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 02:31
If we have any feedback for XAML standard we can email xsfeedback@microsoft.com
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 08:40
Works fine for me even without the changes
And it works fine with the changes as well
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 08:52
Oh wait I'm on Skia
This is on d2d
Still fine
juepiezhongren
@juepiezhongren
Sep 28 2017 09:40
u r going to implement Xaml Standard?@Jeremy Koritzinsky
Stephen Baynham
@CannibalVox
Sep 28 2017 09:48
Hey sorry if this is something somewhat involved, but are there plans to release a core2 compatible project type before beta1? A lot of projects are jumping on board with core2 so it's frustrating not being able to link cleanly
Ah nm I was able to get it running just by manually editing the proj file
Nikita Tsukanov
@kekekeks
Sep 28 2017 10:03
@CannibalVox our nightly builds are already targeting netstandard2.0/netcoreapp2.0
Neil McAlister
@pingzing
Sep 28 2017 11:08
Playing around with Avalonia--is there a navigation-host type control, a la WPF/WinRT's Frame?
Also, what's the preferred (if such a term applies to an alpha framework) method of attaching an event handler to a Button? It looks like markup doesn't support attaching events, though I do see a Command property
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 11:13
@pingzing The stable version on nuget is very outdated, the nightly has event handlers in the same way as wpf iirc
And I think what you're looking for is shown in the controlcatalog sample
Nikita Tsukanov
@kekekeks
Sep 28 2017 11:15
There is no frame control, and I'm not sure if we want to have one. The proper MVVM-like solution would be to use a MarkupExtension or attached property that resolves the page using view locator (something like cal:View.Model from Caliburn.Micro)
Neil McAlister
@pingzing
Sep 28 2017 11:18
Makes sense--Frame always felt like an awkward fit in any MVVM application. Have any thoughts on how to handle things like navigation history, page transitions, and navigation parameters?
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 11:21
Page transitions are in the sample
Nikita Tsukanov
@kekekeks
Sep 28 2017 11:21
Right now we have TabControl and Carousel that support page transitions out of the box
I guess we need a special navigation control with page navigation stack or something like that
With TabControl it works like this:
<TabControl.Transition>
      <CrossFade Duration="0.25"/>
</TabControl.Transition>
@JurjenBiewenga I think @pingzing is talking about mobile-like navigation with navigation stack and Back button
Neil McAlister
@pingzing
Sep 28 2017 11:25
Essentially, yeah.
Nikita Tsukanov
@kekekeks
Sep 28 2017 11:26
It should be fairly easy to do based on Carousel control source code, I think
Only 117 LOC
Neil McAlister
@pingzing
Sep 28 2017 11:27
Hm. Maybe I'll see what I can throw together...
Nikita Tsukanov
@kekekeks
Sep 28 2017 11:27
CarouselPresenter can be reused as is
Since it only operates with Items collection and selected indices
And Items can act as navigation stack
Or may be just reuse Carousel itself
It's used in TabControl, so it should be possible to customize behavior
yep, it seems that Carousel was meant to be used like that
Neil McAlister
@pingzing
Sep 28 2017 11:31
Yeah, I could definitely see just wrapping up Carousel in a lightweight bit of custom code doing what I'm asking about
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 13:27
Can't seem to figure out what is consuming the KeyDown in dropdown when it's open
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 13:55
@grokys Can't seem to figure out why the arrow keys don't work when the dropdown is open, however I've pr'd the changes while the dropdown is closed
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 14:55
Maybe an idea to sign the project up for this? https://hacktoberfest.digitalocean.com/#details
Nikita Tsukanov
@kekekeks
Sep 28 2017 14:58
Apply the label ”Hacktoberfest” to issues in your GitHub project that are ready for new contributors to work on.
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 15:00
Yeah nothing special to participate and maybe an easy way to get some more exposure
Nikita Tsukanov
@kekekeks
Sep 28 2017 19:07
@JurjenBiewenga
  <circle
     class="cls-1"
     cx="115.44"
     cy="115.44"
     r="85.44"
     id="circle9"
     style="stroke:url(#linearGradient4151)" />
  <rect
     class="cls-2"
     x="170.87"
     y="113.93"
     width="59.99"
     height="116.2"
     id="rect11" />
  <circle
     class="cls-3"
     cx="12.55"
     cy="217.62"
     r="12.52"
     id="circle13" />
That's SVG contents of the logo
I'm sure you can't use it as a path
Since it is not one
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 19:08
Awh, that's too bad
wanted to use that as testcase
danwalmsley
@danwalmsley
Sep 28 2017 19:41
There are svg to XAML converters available
Nikita Tsukanov
@kekekeks
Sep 28 2017 19:54
  <Canvas Width="230.87" Height="230.87">
    <Canvas.Resources>
      <LinearGradientBrush x:Key="fill-3" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1">
        <LinearGradientBrush.GradientStops>
          <GradientStopCollection>
            <GradientStop Color="#FF623079" Offset="0"/>
            <GradientStop Color="#FF8B44AC" Offset="0.7"/>
          </GradientStopCollection>
        </LinearGradientBrush.GradientStops>
      </LinearGradientBrush>
      <LinearGradientBrush x:Key="linearGradient4151" MappingMode="Absolute" StartPoint="34,197" EndPoint="197,34">
        <LinearGradientBrush.GradientStops>
          <GradientStopCollection>
            <GradientStop Color="#FF623079" Offset="0"/>
            <GradientStop Color="#FF8B44AC" Offset="0.7"/>
          </GradientStopCollection>
        </LinearGradientBrush.GradientStops>
      </LinearGradientBrush>
    </Canvas.Resources>
    <Ellipse Canvas.Left="30" Canvas.Top="30" Width="170.9" Height="170.9" Name="circle9" Fill="#000000" Stroke="{StaticResource linearGradient4151}"/>
    <Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="170.87" Canvas.Top="113.93" Width="59.99" Height="116.2" Name="rect11" Fill="#000000"/>
    <Ellipse Canvas.Left="0" Canvas.Top="205.1" Width="25" Height="25" Name="circle13" Fill="#000000"/>
  </Canvas>
I'm putting this on Canvas page
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 19:58
Is AppBuilder suppsoed to be sealed?
Nikita Tsukanov
@kekekeks
Sep 28 2017 19:59
Yes
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:01
Wait, sealed doesn't hide it like internal
Why can't I find it then Hmm
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:05
It's not available from netstandard
for reasons
If you want to consume AppBuilder instance from netstandard, you need to declare your method like
public static T UseSomething<T>(this T builder) where T : AppBuilderBase<T>, new()
{
      return builder;
}
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:11
The .net core sample doesn't do that though
That's on netstandard as well right?
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:12
If you are targeting netcoreapp2.0 or net461 AppBuilder is available
If you are targeting netstandard2.0 it is not
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:21
Guys...
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:22
Why the dot?
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:22
because dot NET
Johan Larsson
@JohanLarsson
Sep 28 2017 20:22
looks nice
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:23
It's the new logo variant by @Worldbeater
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:23
Lets hope he has an svg
That looks like a 0 quality jpg
Johan Larsson
@JohanLarsson
Sep 28 2017 20:24
one minute in inkskape to trace it if not
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:24
True
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:24
Because it is
let me upload a proper one
(gitter uploader is broken for me)
danwalmsley
@danwalmsley
Sep 28 2017 20:38
nice!
("pure" variants actually have that white background)
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:47
Is there a netstandard sample?
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:50
See ControlCatalog project
It's targeting netstandard2.0
you can't use AppBuilder from netstandard
Because AppBuilder is platform-specific
It's meant to be used only from program's entry point
And netstandard-targeting assemblies don't have one
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 20:52
Oh, I thought it wasn't targeting netstandard
It can't seem to find the UseGTK and similar
Nikita Tsukanov
@kekekeks
Sep 28 2017 20:57
because netstandard-project shouldn't reference platform-specific stuff
Platform-detection and initial configuration should live in the entry point, Activity or AppDelegate
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 21:04
To be honest, I've got no clue about netstandard
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:08
It's meant to be a target framework for libraries
that want to be xplat-ready
We've figured out the logo variant for white background
Jurjen Biewenga
@JurjenBiewenga
Sep 28 2017 21:09
Why keep the shadow on a white background?
Should either be more pronounced or gone
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:11
It's more lightweight that way
And yet distinguishable from the background
Neil McAlister
@pingzing
Sep 28 2017 21:26
Experimenting with a theoretical UWP target for Avalonia, and have some thoughts:
  • UWP-till-now only supports NETStandard 1.4. The update coming out in October will bump it up to 2.0, but it'll be some time before it rolls out to users at large. Is it worth restricting core components to 1.4 for some time just for that?
  • The iOS and Android backends are hosted on an AppDelegate and a MainActivity, respectively. The UWP equivalent to this would be an Application. However, we also have the option to be hosted on top of a CoreWindow which is, I think, the lowest we can get. Any thoughts on which might be preferable?
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:29
iOS backend is being hosted inside UIView, actually
For Android it's view
Our UIWindow and Activity implementations are just wrappers
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 21:31
We would want to use CoreWindow as the backing for the window implementations themselves. We'd also cross-compile Avalonia.Direct2D1 to have some specific code for UWP since we can create a swap chain for a CoreWindow really easily
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:35
@grokys Portable.Xaml doesn't recognize a property as a collection if it's declared type doesn't have Add method
Neil McAlister
@pingzing
Sep 28 2017 21:35
ah, so maybe there'd be something like a CoreWindowRenderTarget alongside the existing HwndRenderTarget?
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:37
@jkoritzinsky Why couldn't we implement something along the lines of my WPF integration?
So Avalonia controls could be actually embedded inside native UWP views
It works like that for iOS and Android, I don't see why it shouldn't be this way for UWP
This also allows Xamarin.Forms integration
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 21:38
We could with SwapChainPanel, but at least for D2D integration its more efficient at least to support drawing directly onto a CoreWindow
We could have a control with SwapChainPanel in its template for embedding but I feel like UWP is really easy to add full integration like Win32 and get more efficiency out of it.
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:41
So we'll have two separate TopLevel implementations
Mkay, makes sense
BTW, XForms integration looks somewhat like that (sorry for poor image quality): https://i.imgur.com/5uzIn09.png
Neil McAlister
@pingzing
Sep 28 2017 21:47
I'll likely have a full day tomorrow to hack away at a starting UWP implementation--any tips on where I might start? In my little experiment branch, I've got an Avalonia.UWP project, and it seems like the core of these is supposed to be the <platform name>Platform.cs with its static Initialize method. Is that about right?
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:48
I'd recommed to look at MonoMac implementation, it's the simplest one
I'd also recommend to have everything as stubs at first
Neil McAlister
@pingzing
Sep 28 2017 21:51
as in, use those actual stub classes, or just create a bunch of blank classes-that-are-stubs for the platform Impls?
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:51
Only things that are absolutely mandatory to get a new platform running are IPlatformThreadingInterface and ITopLevelImpl (and IWindowImpl on top of it, but most of the methods aren't really neccessary)
See link above
You can copy-paste stubs from there
Neil McAlister
@pingzing
Sep 28 2017 21:53
aha, I gotcha
This is pretty much a "minimal" windowing platform that allows things to not crash
If you are stuck with NETStandard 1.4, you can use packages from nuget and keep your platform implementation in a separate solution
You can get a standalone version of the ControlCatalog there - https://github.com/kekekeks/avalonia-net-core-example/tree/master/VS2017/src/ControlCatalog
Neil McAlister
@pingzing
Sep 28 2017 21:57
you mean the old nuget packages, from before the 2.0 update? or is there some nuget feature to circumvent not running a high enough NETStandard?
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:58
0.5.1 from nuget.org
Neil McAlister
@pingzing
Sep 28 2017 21:58
:+1: gotcha
Nikita Tsukanov
@kekekeks
Sep 28 2017 21:58
It's not like a lot of things have changed since then
AvaloniaUI/Avalonia@b3f3c01 - this is what I had to do to update my 0.5.1-based implementation to the recent master
BTW, is there any way to build UWP-targeted library on win7?
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:03
Nvm, there is development support
I thought it was like those horrible win8.1 app SDK
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:34
@kekekeks any chance we can build a XAML E&C or XAML Live Previewer tool on top of the new designer?
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:34
XAML Live Previewer Tool?
I'm planning to get a standalone utility that can be used to edit (with completion support) and view XAML in environments like Linux where people lack a proper IDE and have to use atrocities based on Electron
And a Rider plugin, I think
Ah, and support for our XAML in AvalonStudio
And support for .NET Core project in our VS extension
Those are the main goals of the new previewer
XAML E&C is completely unrelated beast
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:38
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:39
What's the reason to do that for Avalonia?
We aren't relying on native UI toolkits to render things
So our previewer can be 100% accurate
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:39
Same idea as XAML E&C. Use for editing during debugging instead of before as a previewet
*previewer
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:40
The main issue with E&C
Is that we don't have an AST to work with
So we can't really see the changes
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:40
If we can set up RemoteServer to send the same output to two different listeners then we could do it the similar to our designer.
Just via the UpdateXaml messages the designer uses
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:41
So the only thing that we can do is to reload the page completely
Ah, that
That would be really simple
But won't work for anything more complex than Hello world
The main problem is that if you have any code for XAML manipulation after InitializeComponent
It won't be called
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:42
True
We'd have to figure out something for that
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:42
Well, with our previewer it won't be called either
But still
If we had something for auto-generating properties for x:Name
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:43
It'd be a start we could build a real E&C experience from though. For v1.0 or later.
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:43
It wouldn't be such a severe issue
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:43
Once I get SharpGenTools at 1.0 I'll take a look as some code generation for x:Name
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:44
The main problem with codegen
Is, actually, IDE support
We could create View.generated.xaml.cs files on the fly during the build
But IDE won't see them
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:45
Just have to have it run during design mode build so IDE gets them.
That reminds me I need to do that for SharpGenTools
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:45
Yeah, but they shouldn't be checked out to the source control
So there should also be a MSBuild step
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:45
Then we toss them in the intermediate output directory.
The design mode stuff can be run by the MSBuild design targets
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:46
I'm not familiar with that
How do they work?
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:46
I would just have to figure out which targets I have to put it in.
VS has an internal MSBuild runtime. It does a partial design time evaluation to populate everything about your project in VS
It's a subset of the targets used during a regular build
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:47
Will it run after changing a xaml file?
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:49
That's what I'm not sure on. There's probably a way we can make it with the MSBuild script
I'll investigate
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:49
For WPF VS detects changes even in unsaved files
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:52
I just need to figure out the specifics of when the design time build runs
That's what I'm having the most difficulty finding.
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:54
I've just checked, it updates the UserControl.g.i.cs when keyboard focus leaves XAML window
Another problem is that we can't actually determine types of XAML elements without compiled binaries
So we need to run roslyn to analyze not-yet-valid source code
WPF also uses two-stage compilation to achieve that
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:56
Nice part about roslyn is you can get a semantic model from a failed build
So as long as we can find the types we should be able to generate the code.
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:57
Bad part about using roslyn is that it will double compilation time
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:58
True... It's too bad that the roslyn team hasn't figured out a good IDE UX for code generators. Then we'd already have this already solved.
Nikita Tsukanov
@kekekeks
Sep 28 2017 22:59
And all that stuff means really, really tight IDE integration. It will be hard to write a plugin for, let's say, Rider, that would support all of that
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 22:59
As long as we keep it in MSBuild we can make the rider plugin run the design time build. OmniSharp might actually support design time builds. I'm not sure.
Nikita Tsukanov
@kekekeks
Sep 28 2017 23:04
Another option is to get something like
[XamlImport("ControlName")]
public TextBox ControlName{get;set;}
And tell people to use it instead of FindControl if they want live previewer to work
AvaloniaXamlLoader will scan for these attributes after loading XAML and that's it
Oh, there is another issue with reloading the whole page
For example, you had something like
<Window xmlns="http://github.com/avaloniaui" Background="Red">

</Window>
And then changed it to
<Window xmlns="http://github.com/avaloniaui">

</Window>
Background will stay red
I don't know how to do a proper clean up before loading new state
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 23:15
The Metadata option could work.
And that issue with undoing assignments is definitely a problem we'd have to figure out.
I have an idea but it's probably super inefficient and we'd definitely want to have a switch to turn on/off
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 23:20
When we do load XAML into an object (aka we supply the root), we record the current state in some way if we haven't recorded it yet. Then when we reload the Xaml we first restore to that initial state.
That still doesn't account for callbacks in attributes yet tho
We could save space by only storing AvaloniaProperty values that differ from the default (aka something set in the constructor before calling InitaluzeComponent)
Nikita Tsukanov
@kekekeks
Sep 28 2017 23:33
It's really, really complex stuff. I think we should focus on getting previewer to be operational instead
So it would be easy to wire up some mock data in design-time
Since in case of previewer we can just kill the previous control instance
Jeremy Koritzinsky
@jkoritzinsky
Sep 28 2017 23:52
Definitely. We can put this off for a while. I think we should collect notes/ideas in either a wiki page or a repo so we can preserve discussions we've had
Previewer is much more important. This comes much later. There's a reason Microsoft recently added support for XAML E&C