These are chat archives for AvaloniaUI/Avalonia

26th
Jun 2018
danwalmsley
@danwalmsley
Jun 26 2018 10:08
@grokys is there some kind of selected like in listbox we can select even items and odd items?
basically I want to have different background colour for alternating rows in a listbox
essentially a poor mans table
Steven Kirk
@grokys
Jun 26 2018 10:19
@danwalmsley not currently no :/
it should be possible for us to do it like in CSS i think, with a selector
so it can be done for any set of controls
danwalmsley
@danwalmsley
Jun 26 2018 10:23
thanks :)
@grokys did you remember about the issue where arrow key navigation is broken, for menu items, listboxes, etc?
Steven Kirk
@grokys
Jun 26 2018 10:25
yeah, i started work on it a while back but then got distracted by the deluge of PRs
danwalmsley
@danwalmsley
Jun 26 2018 10:26
:)
just checking it was still on the radar,
Steven Kirk
@grokys
Jun 26 2018 10:35
i think to do it properly it's going to be quite a big change
danwalmsley
@danwalmsley
Jun 26 2018 14:21
anyone noticed that copying text from avalonia will paste into notepad, VS, etc and other avalonia controls, but not things like web browser or other apps
Benedikt Schroeder
@Gillibald
Jun 26 2018 14:25
Maybe the DataFormat isn't the right one. Haven't checked how the Clipboard is implemented in Avalonia.
danwalmsley
@danwalmsley
Jun 26 2018 14:25
I think that's it
im experimenting now
but do you have an example of win32 copy and paste for text?
Benedikt Schroeder
@Gillibald
Jun 26 2018 14:27
Just had a look at how WPF does it that should help a bit.
Jumar Macato
@jmacato
Jun 26 2018 14:28
@Gillibald i think it's a bad idea to look at their code. perhaps we can use another example elsewhere?
Benedikt Schroeder
@Gillibald
Jun 26 2018 14:29
Just look at the native the native stuff
Jumar Macato
@jmacato
Jun 26 2018 14:29
right
Thats for the Win32 API's
Jumar Macato
@jmacato
Jun 26 2018 14:30
Alright, that's a much better resource :smile: thanks!
Benedikt Schroeder
@Gillibald
Jun 26 2018 14:31
But you can always use your own
danwalmsley
@danwalmsley
Jun 26 2018 14:45
@jmacato here is the fix
I would be grateful for a quick review and merge. its only 1 line change! :)
Jumar Macato
@jmacato
Jun 26 2018 14:46
sure, looks good to me
can you wait for CI to finish?
danwalmsley
@danwalmsley
Jun 26 2018 14:47
yes
Jumar Macato
@jmacato
Jun 26 2018 14:48
Alright, will merge when done :smile:
sdoroff
@sdoroff
Jun 26 2018 14:57
I pushed the DataGrid code to https://github.com/AvaloniaUI/DataGrid
Jumar Macato
@jmacato
Jun 26 2018 14:57
:clap: :clap: :clap:
sdoroff
@sdoroff
Jun 26 2018 14:58
It's still an early alpha build and the templates are pretty ugly, but its relatively functional
Benedikt Schroeder
@Gillibald
Jun 26 2018 14:59
CollectionView will be an interesting part for other controls
Rayyan Tahir
@RayyanTahir
Jun 26 2018 14:59
WindowStartupLocation="CenterScreen" does not place the Window in the center of screen.
sdoroff
@sdoroff
Jun 26 2018 15:02
@Gillibald - there's a CollectionViewBase class in there now. I'm hoping to build a more robust CollectionView API down the road
Jumar Macato
@jmacato
Jun 26 2018 15:02
@sdoroff we could probably integrate that on control primitives, can't we?
sdoroff
@sdoroff
Jun 26 2018 15:03
@jmacato - I think that makes sense down the road once we land on a stable API
Jumar Macato
@jmacato
Jun 26 2018 15:04
Alright, i agree
Jumar Macato
@jmacato
Jun 26 2018 15:14
@danwalmsley #1702 merged!
Jumar Macato
@jmacato
Jun 26 2018 15:26
@sdoroff it seems that you forgot to add nuget.config on the repo for AvaloniaCI nuget source
Jumar Macato
@jmacato
Jun 26 2018 15:33
image.png
Super awesome work @sdoroff :smile:
Steven Kirk
@grokys
Jun 26 2018 15:59
eugh, i really don't want CollectionView in avalonia
CollectionView is what made me stop trying to re-implement WPF and decide to do my own API
it's that horrible
Benedikt Schroeder
@Gillibald
Jun 26 2018 16:04
So you want to use collection transforms to sort and group? How to you visualize groupings? I mean you can always bring your own model for that and defines templates but thats a common use case.
Steven Kirk
@grokys
Jun 26 2018 16:06
what do you mean by collection transforms?
(really nice work btw @sdoroff !)
Benedikt Schroeder
@Gillibald
Jun 26 2018 16:12
A TransformedCollection is a wrapper for a source collection that updates itself and wraps items in a specified container. I use that to transform collections of entities to viewmodels.
so just to be clear, i'm not against the concept of a CollectionView - just the implementation/API from WPF
a few things that it does wrong (these are just the ones off the top of my head - i know there are others)
  1. it mixes selection and transformation
  2. it doesn't handle multiple selection
  3. uses reflection heavily
  4. C#1-based
  5. hard to override behavior in it
  6. calls virtual methods from constructors
Benedikt Schroeder
@Gillibald
Jun 26 2018 16:22
Looks like it does the same.
So a CollectionView could be implemented with a derived list
Steven Kirk
@grokys
Jun 26 2018 16:24
something like that
it depends if the collection view is at the view model or view layer
Steven Kirk
@grokys
Jun 26 2018 16:31
and just to prove i've been there, i wrote these tests for CollectionView: https://github.com/grokys/Avalonia/blob/master/Wpf.UnitTests/Data/CollectionViewTests.cs and the start of a reimplementation https://github.com/grokys/Avalonia/blob/master/Avalonia/Data/CollectionView.cs
before deciding to give up on re-implementing WPF and start on Perspex (which was later renamed to Avalonia, the same name as my aborted reimplementation of WPF ;) )
Nelson Carrillo
@nc4rrillo
Jun 26 2018 16:48
Wow the data grid looks great
Benedikt Schroeder
@Gillibald
Jun 26 2018 16:53
If I set Window.Background to Transparent it is rendered White. Am i doing something wrong?
This is with DirectX. Skia renders it black (transparent)
Jumar Macato
@jmacato
Jun 26 2018 16:56
@Gillibald AvaloniaUI/Avalonia#1686
@Karnah seems to have encountered the same issue as yours
Benedikt Schroeder
@Gillibald
Jun 26 2018 16:57
I dont use Images. Just an empty window with Background set to Transparent
Jumar Macato
@jmacato
Jun 26 2018 17:00
still applicable since it involves brushes, i think
Vsevolod Pilipenko
@Karnah
Jun 26 2018 17:01
Hello. I'll watch it
Vsevolod Pilipenko
@Karnah
Jun 26 2018 17:09
Hmm
I have black window on Direct2D1 too
Nelson Carrillo
@nc4rrillo
Jun 26 2018 17:12
D2D made a black window for me last I checked
sdoroff
@sdoroff
Jun 26 2018 17:25
@grokys - I agree CollectionView is kind of terrible. My current plan is to get the control fully implemented then remove a much service area as possible from ICollectionView as possible then come up with an API from there.
Steven Kirk
@grokys
Jun 26 2018 17:25
yeah that sounds like a great idea!
i think it definitely made sense to implement CollectionView to get things working
Nelson Carrillo
@nc4rrillo
Jun 26 2018 17:34
so what is the different between a normal AvaloniaProperty and a DirectProperty? Do DirectProperties not interact with property inheritance?
Jeremy Koritzinsky
@jkoritzinsky
Jun 26 2018 17:54
DirectProperties don't support multiple bindings at different priority levels (which is a requirement for styling / animation). They're meant to be used for user data pulled directly from a ViewModel/Model. They're much lower overhead.
Benedikt Schroeder
@Gillibald
Jun 26 2018 19:24
Is it possible to render to a PlainOffscreenSurface with our DirectX backend?
Steven Kirk
@grokys
Jun 26 2018 19:26
That's a really good way to put it @jkoritzinsky! I've been struggling to explain when to use one over the other
@nc4rrillo you can think of direct properties as pretty much INPC properties, they're backed by a field on your class
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:08
oh cool that makes sense
I'm working with @jmacato to flesh out the transitions code using the new animations changes he made :)
early video there :)
created by the following XAML
  <ListBox Items="{Binding}" Width="250" Height="350">
    <ListBox.ChildrenTransitions>
        <Transitions>
            <CrossFadeTransition Duration="1.20" />
        </Transitions>
    </ListBox.ChildrenTransitions>

    <ListBox.ItemTemplate>
        <DataTemplate>
            <TextBlock FontSize="30"  Text="{Binding Header}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
  </ListBox>
remade the CrossFade transition and the slide transition so far into prebuild transitions that animate based on IsVisible changing
each visual has a Transitions collection, ItemsControl has a ChildrenTransitions collection which get applied to its children
Steven Kirk
@grokys
Jun 26 2018 20:33
that's cool @nc4rrillo !
interesting idea having transitions on controls as well as properties
i'd not thought of it like that
so what would happen if i put a CrossfadeTransition on say a Button?
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:34
well the transitions are still on properties, just CrossFadeTransition implicitly animates the opacity property in response to an IsVisible change so its a bit more high level
but you can still add a normal Transition and add the target property yourself
Steven Kirk
@grokys
Jun 26 2018 20:35
yeah, fade in/out in response to setting visibility would be such a nice feature
is that what CrossfadeTransition does?
if so it should probably just be FadeTransition because a crossfade is between two items
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:36
yes, and you're right :)
I should change it to just Fade
Steven Kirk
@grokys
Jun 26 2018 20:37
should probably have separate properties for fade in/fade out?
or maybe you'd just apply two transitions?
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:38
Can make it FadeIn and FadeOut and to have both you just would add both to the collection
right now the transition sees if it's going from false to true or from true to false
Steven Kirk
@grokys
Jun 26 2018 20:38
or have all 3...
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:38
yeah it cant hurt
but I like that the high level transitions just build on the lower level transition infrastructure, and that you can compose many together
for example a Fade and a Slide
Steven Kirk
@grokys
Jun 26 2018 20:39
yeah, that's a really cool idea
something i've wanted in every framework i've used
next thing: if we made Bounds a styled property, then you could transition control positions/sizes
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:41
oh that would be very cool
Nelson Carrillo
@nc4rrillo
Jun 26 2018 20:46
https://www.youtube.com/watch?v=iFOqhn6Rrlc slide + bounce easing function
danwalmsley
@danwalmsley
Jun 26 2018 21:33
@sdoroff is the datagrid available as a nuget package?
Steven Kirk
@grokys
Jun 26 2018 22:14
another memory-reducing PR: AvaloniaUI/Avalonia#1703
down from 155,117kb to 56,749kb now :D
almost 100mb of heap memory saved!