These are chat archives for AvaloniaUI/Avalonia

20th
May 2018
Wiesław Šoltés
@wieslawsoltes
May 20 2018 09:20
<ItemsControl.Styles>
    <Style Selector="ItemsControl > ContentPresenter">
        <Setter Property="DockPanel.Dock" Value="{Binding Dock}"/>
    </Style>
</ItemsControl.Styles>
I was looking for this all day yesterday :smile:
Benedikt Schroeder
@Gillibald
May 20 2018 12:04
Should I create a new PR for my IAssetLoader changes or is it fine if I just include them in my font PR?
Benedikt Schroeder
@Gillibald
May 20 2018 12:26
Why isn't IAssetLoader called IResourceLoader? You always access Assembly.Resources so it should be called IResourceLoader in my opinion. It is just a name. I wonder where this comes from.
Wiesław Šoltés
@wieslawsoltes
May 20 2018 12:38
@danwalmsley For my docking control I probably will need to port this https://www.codeproject.com/Articles/34377/DockPanel-Splitter-Control-for-WPF
Maybe it can be merged into main Avalonia repo, not sure.
Wiesław Šoltés
@wieslawsoltes
May 20 2018 12:55
Steven Kirk
@grokys
May 20 2018 13:46
@Gillibald resources is ambiguous with Control.Resources, you notice that in the MVVM template we assume that "assets" are stored in an "Assets" folder
that comes from UWP
which i assume did it because of the ambiguity
Benedikt Schroeder
@Gillibald
May 20 2018 14:09
I will just follow that naming convention. Still I don't agree with it. But thats fine.
Jeremy Koritzinsky
@jkoritzinsky
May 20 2018 15:19
I think you should do it in a separate PR. That way the PRs are more self-contained and easier to review.
danwalmsley
@danwalmsley
May 20 2018 16:46
@wieslawsoltes avalonstudio uses a similar control, where you can horizontally split or vertically split, Here...
But porting something like that may be more useful
I think we need to open an extended controls repo asap
For stuff like this, any ideas on that we should call it?
Nelson Carrillo
@nc4rrillo
May 20 2018 16:51
Avalonia community toolkit or extended toolkit
Corefx has the concept of “corefxlab” which is for experimental ideas, could also go with a naming convention like that
Jeremy Koritzinsky
@jkoritzinsky
May 20 2018 17:12
Avalonia.Controls.Extended I think would work
Wiesław Šoltés
@wieslawsoltes
May 20 2018 17:20
Wiesław Šoltés
@wieslawsoltes
May 20 2018 17:57
2018-05-20_19-56-34.png
@danwalmsley Dock layout created fully from dock model :fire:
Its easily serialized to/from json
danwalmsley
@danwalmsley
May 20 2018 18:15
Great work, so can you dock stuff to the sides of other docks now?
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:15
Not yet implemented with behaviors
Only manually from code
All is done by manipulating dock model
danwalmsley
@danwalmsley
May 20 2018 18:16
I would like to have ago at implementing the part where you are dragging and it indicates where you can drop to, like the drop target indicator on visual studio
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:16
The docking UI is automatically created using Avalonia XAML
I have partial implementation for that already using adorners
should be relatively easy do add the rest
There are many hacks but should be simple to generalize
danwalmsley
@danwalmsley
May 20 2018 18:18
Everything in Dock. Avalonia is what's needed right?
Do you think it's at a stage I could test or begin integrating to AvalonStudio
?
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:19
Not yet
danwalmsley
@danwalmsley
May 20 2018 18:19
Ok I'll wait 😀
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:19
I change stuff as I go
But I am very happy with current progress
danwalmsley
@danwalmsley
May 20 2018 18:20
It's impressive
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:20
:smile:
danwalmsley
@danwalmsley
May 20 2018 18:20
I'm glad you did a new approach rather than porting something existing
Looks to be a much better solution
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:20
Its MVVM :fire:
danwalmsley
@danwalmsley
May 20 2018 18:21
How when you load a layout do you identify which classes and views to load?
Just view locator?
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:21
I use concrete types for views
danwalmsley
@danwalmsley
May 20 2018 18:23
Does Dock View put the required chrome around each one?
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:23
Everything in my app is dockable (well will be)
This are containers for views
I want to make it easy to separate docking logic from Xaml
danwalmsley
@danwalmsley
May 20 2018 18:25
That's looking excellent can't wait to try it out
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:25
So its easy to change look and feel
This is for windows
All windows can save and restore there position and size
I want to use this also for my other app windows to save layout of those too
Still one big thing is to figure out how to handle DataContext for each view
This is important for serialization
danwalmsley
@danwalmsley
May 20 2018 18:41
In Avalon Dock each view model you had to associate with a unique id
As far as I can remember
But it wasn't very easy to use with mvvm the de serialization part was a bit wierd
Benedikt Schroeder
@Gillibald
May 20 2018 18:42
Is there a reason Application has no MainWindow and open windows are made available under window rather than under Application?
We probably need to hook here somehow context initialization
danwalmsley
@danwalmsley
May 20 2018 18:45
in AvalonStudio, I ViewModelViewHost where when you set the DataContext, it automatically locates the correct View by naming convention
I wonder if we could allow the serialization to be configured so it saves with the View, the ViewModel or both
would that make sense?
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:46
well you can use concrete types for all views and that use locator with convetion
danwalmsley
@danwalmsley
May 20 2018 18:46
I guess its same thing in reverse
so yeah :)
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:46
                    {
                      "$id": "7",
                      "$type": "Core2D.Avalonia.Dock.Views.ProjectView, Core2D.Avalonia",
                      "Width": "NaN",
                      "Height": "NaN",
                      "Title": "Project"
                    },
So you locate DataContext based on ProjectView type
Not sure how you do this in your current code :smile:
Maybe you can hook up IServiceProvider
danwalmsley
@danwalmsley
May 20 2018 18:48
If I have a type ProjectViewModel, I look for a type called ProjectView and then create that
Wiesław Šoltés
@wieslawsoltes
May 20 2018 18:49
But when you deserialize you want to preserve property values
So I want only set Context property after I have deserialized layout
Benedikt Schroeder
@Gillibald
May 20 2018 19:07
Is it possible to avoid XAML entirely without losing any feature you have with XAML? Features like Binding, DynamicResource, RelativeSource, etc
danwalmsley
@danwalmsley
May 20 2018 19:08
everything can be done in code
Wiesław Šoltés
@wieslawsoltes
May 20 2018 19:08
@danwalmsley IDictionary<Type, Func<object>> ContextLocator { get; set; }
Something like that
            ContextLocator = new Dictionary<Type, Func<object>>
            {
                [typeof(IDock)] = () => _serviceProvider.GetService<ProjectEditor>()
            };
        public virtual object GetContext(object source, object context)
        {
            return ContextLocator?[source.GetType()].Invoke() ?? context;
        }
Benedikt Schroeder
@Gillibald
May 20 2018 19:09
Have to prototype that first before I can start on compiled xaml.
Wiesław Šoltés
@wieslawsoltes
May 20 2018 19:09
That after created/deserialized I will updated Context of all elements of layout.
@Gillibald I think Avalonia started as code first
Xaml was added later
Benedikt Schroeder
@Gillibald
May 20 2018 19:14
I am planning to translate xaml to C#. To achieve that I probably need to introduce some fluent api first to make it easier to translate the markup. Everything should behave the same. Updates to binding, property sets etc.
danwalmsley
@danwalmsley
May 20 2018 19:15
are you planning to use Portable.Xaml to parse?
Benedikt Schroeder
@Gillibald
May 20 2018 19:16
To make x:Class happen we always have to translate xaml to C#
Yes Portable.Xaml is used to read the xml
danwalmsley
@danwalmsley
May 20 2018 19:24
Start very basic get it to just generate code to instantiate a class and set properties
Then after add bindings and data templates
Jeremy Koritzinsky
@jkoritzinsky
May 20 2018 19:25
The most interesting feature will be supporting custom markup extensions. I'm very interested to see what you come up with.
My suggestion for how to start based on the Roslyn API. Use the Workspace APIs to load in the source code and references into memory. Then make custom Portable.Xaml services to fetch information from the Metadata. Then use the Document APIs to generate code using language-agnostic APIs.
Benedikt Schroeder
@Gillibald
May 20 2018 19:27
This needs some heavy prototyping and will be a work in progress for a long time so dont expect that to be finished soon. Roslyn will we used to generate the code. I have a test application in mind like linqpad where you can define xaml and compile that at any time to display it.
Jeremy Koritzinsky
@jkoritzinsky
May 20 2018 19:27
:+1:
danwalmsley
@danwalmsley
May 20 2018 19:29
Sounds like a plan 😀
@Gillibald I'll test out your font stuff shortly
Hoping to get that merged this week
Wiesław Šoltés
@wieslawsoltes
May 20 2018 19:29
@danwalmsley wieslawsoltes/Core2D@7c9cdfb
Added initial implementation of DataContext locator for views
danwalmsley
@danwalmsley
May 20 2018 19:30
@wieslawsoltes woah that was quick
Wiesław Šoltés
@wieslawsoltes
May 20 2018 19:31
Just quick dictionary :smile:
You have to implement your own factory, similar to my EditorDockFactory
danwalmsley
@danwalmsley
May 20 2018 19:32
Great. Should be very easy to integrate now
Wiesław Šoltés
@wieslawsoltes
May 20 2018 19:32
I hope so :smile:
Wiesław Šoltés
@wieslawsoltes
May 20 2018 20:41
Moved code to separate repository.
Wiesław Šoltés
@wieslawsoltes
May 20 2018 23:56
@danwalmsley Added docking panel slitter support to Dock.
It also saves and restores splitter position.