These are chat archives for AvaloniaUI/Avalonia

23rd
Jan 2016
Steven Kirk
@grokys
Jan 23 2016 02:35
@danwalmsley yeah, sorry, it's taking a little longer than I expected, both due to day job and due to what seems to be my stupidity ;)
for overriding styles the closest one to the control should take precendence
Nikita Tsukanov
@kekekeks
Jan 23 2016 12:55

@danwalmsley
https://ci.appveyor.com/project/Perspex/perspex/build/1.0.1005

Pushing Perspex 9999.0.1005-nightly to 'https://www.myget.org/F/perspex-nightly/api/v2/package'...
Your package was pushed.
Pushing Perspex.Desktop 9999.0.1005-nightly to 'https://www.myget.org/F/perspex-nightly/api/v2/package'...
Your package was pushed.
Pushing Perspex.Skia.Desktop 9999.0.1005-nightly to 'https://www.myget.org/F/perspex-nightly/api/v2/package'...
Your package was pushed.
Pushing Perspex.Android 9999.0.1005-nightly to 'https://www.myget.org/F/perspex-nightly/api/v2/package'...
Your package was pushed.
Pushing Perspex.iOS 9999.0.1005-nightly to 'https://www.myget.org/F/perspex-nightly/api/v2/package'...
Your package was pushed.

Should be working fine
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 14:02
Finally C# will get proper tuples and pattern matching. This should make a lot of code more readable and easier to use.
Steven Kirk
@grokys
Jan 23 2016 15:41
that will be great! would be nice if we also got discriminated unions too
Steven Kirk
@grokys
Jan 23 2016 18:03
@danwalmsley ok, i've just pushed quite a big update to master which should allow two-way binding of TreeViewItem.IsExpanded
it may break a few things - i tried to test it with AvalonStudio but it's not currently compiling so I couldn't
the main visible change is that PerspexObject.GetObservable has been moved to an extension method
so you may need to prefix calls to that with this.
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:10
@grokys I had this code before latest merge:
        private static void RefreshBinding(PerspexObject target, PerspexProperty property)
        {
            IXamlBinding binding = target.GetValue(property) as IXamlBinding;
            if (binding != null)
            {
                binding.Bind(target, property);
            }
        }
but there is no more IXamlBinding and IBinding does not have Bind method
Steven Kirk
@grokys
Jan 23 2016 19:12
yep, that's all changed - use IBinding and then use the Bind extension method: https://github.com/Perspex/Perspex/blob/master/src/Perspex.Controls/ControlExtensions.cs#L24
you need an IControl for that method though as the binding needs to act differently if it's bound to the DataContext property, which is only defined on IControl
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:20
Yeah, but I have PerspexObject not an IControl so extension method will not work.
        private static void RefreshBinding(PerspexObject target, PerspexProperty property)
        {
            IBinding binding = target.GetValue(property) as IBinding;
            if (binding != null)
            {
                var mode = binding.Mode;

                if (mode == BindingMode.Default)
                {
                    mode = property.DefaultBindingMode;
                }

                target.Bind(
                    property, 
                    binding.CreateSubject(target, property),
                    mode,
                    binding.Priority);
            }
        }
Will this work ?
Steven Kirk
@grokys
Jan 23 2016 19:20
yeah, that should work i think
actually... i think we can do that binding without an IControl can't we?
the extension method doesn't actually require an IControl
it did at some point, but no longer
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:22
Well I had run into this issue before when working with XamlBehaiors
in Perspex you had many things dependent on IControl but in XamlBehaviors the PerspexObject is the lowest level not IControl
Steven Kirk
@grokys
Jan 23 2016 19:24
yeah
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:24
I think this is because not everything in xaml has to be UI
Steven Kirk
@grokys
Jan 23 2016 19:24
yeah, the changes i made were on the way to allowing that
still some way to go though
hold on, let me move that Bind method to IPerspexObject
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:25
ok
Steven Kirk
@grokys
Jan 23 2016 19:28
ok, comitted
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:30
great, thanks
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 19:56
@grokys Menus are broken after latest updates :(
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 20:05
The DropDown has issues and scrolling is broken too
Steven Kirk
@grokys
Jan 23 2016 20:08
ah yeah, indeed
i knew something would break but i didn't expect it'd be those!
Steven Kirk
@grokys
Jan 23 2016 20:21
ok, that was easy to fix - committed
Wiesław Šoltés
@wieslawsoltes
Jan 23 2016 20:40
Menus and DropDown's work again
The scrolling is still broken in my tests
Steven Kirk
@grokys
Jan 23 2016 20:45
hmm, ok