These are chat archives for AvaloniaUI/Avalonia

14th
Oct 2017
danwalmsley
@danwalmsley
Oct 14 2017 08:59
@grokys is this todo still valid?
Steven Kirk
@grokys
Oct 14 2017 08:59
yeah, see AvaloniaUI/Avalonia#1211
danwalmsley
@danwalmsley
Oct 14 2017 09:02
@kekekeks can you approve the review on AvaloniaUI/Avalonia#1210
@grokys can you merge this
AvaloniaUI/Avalonia#1216
Steven Kirk
@grokys
Oct 14 2017 09:07
@danwalmsley done
danwalmsley
@danwalmsley
Oct 14 2017 09:12
thanks
was mainly so I could get a commit on master to trigger #1210 ci again, for some reason appveyor hadn't picked its latest commit up
Steven Kirk
@grokys
Oct 14 2017 09:14
oh weird
we should disable osx builds too...
they're failing
danwalmsley
@danwalmsley
Oct 14 2017 09:14
is that done from travis.yml ?
Steven Kirk
@grokys
Oct 14 2017 09:15
yeah, just pushed a change to master removing it
Nikita Tsukanov
@kekekeks
Oct 14 2017 11:27
@grokys would you mind if I copy-paste your avalonia-related articles to avaloniaui.net ?
Steven Kirk
@grokys
Oct 14 2017 12:11
no of course not, please do!
how long has avaloniaui.net existed?
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:14
Creation Date: 2017-09-21T20:45:57Z
Steven Kirk
@grokys
Oct 14 2017 12:15
oh cool! the theme is a lot better than the one we had before too
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:15
It's a different generation engine
Steven Kirk
@grokys
Oct 14 2017 12:15
ohh nice. what are you using?
docfx sucks
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:15
I think I'll move all of that to a separate repo
Since we only need to update api doc on release
So the main repo can be referenced via submodule
Steven Kirk
@grokys
Oct 14 2017 12:18
ok, sounds good to me. so glad we have a working docs generator! i tried a few times to work on the docfx stuff and just nothing worked
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:18
The main problem is that it generates 500MB of files
So it would be a bit troublesome to set up a CI build
For now I'll be uploading that manually, I think
Steven Kirk
@grokys
Oct 14 2017 12:19
how long does it take to generate?
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:20
Several minutes
Almost instantly if you skip api docs
We also need to figure out something about placing articles in the right order
It doesn't have a concept of proper TOC
It's really customizable though, so we can fix that
That's a customized template of the navbar, for example
danwalmsley
@danwalmsley
Oct 14 2017 12:26
@grokys / @kekekeks if I do this
protected override void OnPointerPressed(PointerPressedEventArgs e)
        {
            base.OnPointerPressed(e);

            if (!InEditMode)
            {
                if (e.MouseButton == MouseButton.Middle)
                {
                    InEditMode = true;
                    e.Device.Capture(this);
e.Device.Capture(this)
how can I release mouse capture when not inside a Pointer event handler?
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:29
you need to obtain MouseDevice from TopLevel
Or save it somewhere when you take capture
BTW
@grokys
I think that Capture should return IDisposable
danwalmsley
@danwalmsley
Oct 14 2017 12:30
that would be nice
how do you get top level?
Nikita Tsukanov
@kekekeks
Oct 14 2017 12:30
I never really liked the way of releasing capture in WPF
this.GetVisualRoot() or something like that
danwalmsley
@danwalmsley
Oct 14 2017 12:33
(VisualRoot as IInputRoot).MouseDevice.Capture(null);
???
Steven Kirk
@grokys
Oct 14 2017 12:35
yeah Capture returning IDisposable is a good idea! only thing is that Capture on WPF returns a bool indicating whether capture could be taken. i guess we could return a null IDisposable instead of false
@danwalmsley yeah that looks right
we should probably add InputElement.Capture() too to be consistent with WPF
danwalmsley
@danwalmsley
Oct 14 2017 12:37
@grokys I did #1219 with extension methods for checking if point is inside control bounds
i didn't add it to bounds because there was already a Contains method for bounds
but it doesn't seem to work with relative points
Steven Kirk
@grokys
Oct 14 2017 12:39
hmm, i'm not sure an extension method is really needed for that?
danwalmsley
@danwalmsley
Oct 14 2017 12:40
you think it should be a method on the control itself?
Steven Kirk
@grokys
Oct 14 2017 12:40
no, i just don't think it's much shorter or clearer than just saying new Rect(control.Bounds.Size).Contains(point);
danwalmsley
@danwalmsley
Oct 14 2017 12:41
for me it was more about discoverability
Steven Kirk
@grokys
Oct 14 2017 12:46
hmm, not sure
what wasn't discoverable before?
danwalmsley
@danwalmsley
Oct 14 2017 12:50
it was not obvious how to check if a point is inside the bounds of a control until id asked you
its started by looking for things like
control.HitTest, control.ContainsPoint, etc
i know hit testing is different now
iv been trying to find wpf equivalent
Steven Kirk
@grokys
Oct 14 2017 12:58
well on WPF you'd do it using if (p.X < control.ActualWidth && p.Y < control.ActualHeight) so if you know that, and know that our equivalent of ActualWidth and ActualHeight is Bounds it should be quite obvious to me...
i don't know... i'm concerned about cluttering up the API with too much stuff
danwalmsley
@danwalmsley
Oct 14 2017 12:58
yeah
Steven Kirk
@grokys
Oct 14 2017 12:59
and i don't know how often someone would want to do this?
danwalmsley
@danwalmsley
Oct 14 2017 12:59
ok maybe it is more suited to some extension / helper methods in users library
id just assumed it would be a common operation when your developing controls
Steven Kirk
@grokys
Oct 14 2017 13:00
yeah, it might be i guess? i can only speak personally in saying i don't think it's that useful
maybe other people have a different perspective?
what do you need it for? usually a hit test would be more appropriate i'd have thought
danwalmsley
@danwalmsley
Oct 14 2017 13:02
its for my editable textblock control
when use clicks outside you want to accept the changes and save, and go back to being a normal textblock
if you do hit test, it finds child controls like textpresenter
Steven Kirk
@grokys
Oct 14 2017 13:05
right, so i guess it's not so important there, but the correct way to do it would be to do a hit test and then say if (this.IsVisualAncestorOf(hit)) - this way you could e.g. have rounded corners on the text box and clicking outside the rounded corners would count as a non-hit and so go back to being a normal textblock
danwalmsley
@danwalmsley
Oct 14 2017 13:08
ah ok
right that's much better
Steven Kirk
@grokys
Oct 14 2017 13:09
that would also make it work with render transforms too
as you can transform a control outside its bounds
you should be able to use that, and if it returns null the click was outside your control
danwalmsley
@danwalmsley
Oct 14 2017 13:22
ah ok then I think this was a useful conversation
I had to do this..
var hit = this.InputHitTest(e.GetPosition(this));

                if (!this.IsVisualAncestorOf(hit))
                {
                    ExitEditMode();
                }
to make it work
if you check for null
it returns what you clicked on outside the control
so perhaps that was a bug?
i tried this yesterday, and because it didn't return null, i just thought it was intended behaviour and I was misusing the method
Steven Kirk
@grokys
Oct 14 2017 13:29
if you use InputHitTest you mean?
danwalmsley
@danwalmsley
Oct 14 2017 13:30
yes
Steven Kirk
@grokys
Oct 14 2017 13:31
ah yes - that does indeed sound like a bug!
danwalmsley
@danwalmsley
Oct 14 2017 13:50
@grokys can you have a look here:
AvaloniaUI/Avalonia#1220
its potentially some kind of binding bug, if not its certainly a bug in textbox / textpresenter
first animation shows you what I'm seeing, second one shows me debugging into textpresenter, basically
it shows that Textbox.Text has been set to a value
but that the textpresenter text property is still null
Steven Kirk
@grokys
Oct 14 2017 13:52
sure, will take a look
danwalmsley
@danwalmsley
Oct 14 2017 13:52
It looks like they are bound together
animation of debug session will show you straight away i think though
does the explanation make sense?
Steven Kirk
@grokys
Oct 14 2017 13:57
yeah i think so
Steven Kirk
@grokys
Oct 14 2017 14:09
ok @danwalmsley AvaloniaUI/Avalonia#1222
danwalmsley
@danwalmsley
Oct 14 2017 14:10
that simple!
wow! thanks mate
will test it out asap
Steven Kirk
@grokys
Oct 14 2017 14:14
we should probably use https://msdn.microsoft.com/en-us/library/system.xaml.xamlmember.dependson(v=vs.110).aspx for Text and CaretIndex if Portable.Xaml supports that
danwalmsley
@danwalmsley
Oct 14 2017 14:19
that fixes my issue, so thanks
but yeah we should see if depends on is supported
Steven Kirk
@grokys
Oct 14 2017 14:24
it seems to be yeah, let me try that
@grokys may I ask you to post any new avalonia-related articles there? https://github.com/AvaloniaUI/avaloniaui.net/tree/master/wwwroot/blog
Steven Kirk
@grokys
Oct 14 2017 14:26
sure!
great you've got that working, now everyone can blog! :)
Nikita Tsukanov
@kekekeks
Oct 14 2017 14:27
We probably want to add support for https://www.reddit.com/buttons/
Since we are posting release links on reddit anyway
Steven Kirk
@grokys
Oct 14 2017 14:36
@danwalmsley looks like DependsOn isn't supported yet in portable.xaml
danwalmsley
@danwalmsley
Oct 14 2017 14:46
Ok il merge your pr
shall we merge #1214 next?
Steven Kirk
@grokys
Oct 14 2017 14:56
yeah i think so
danwalmsley
@danwalmsley
Oct 14 2017 15:44
editable-textblock.gif
finally got my editable textblock finished off :)
Steven Kirk
@grokys
Oct 14 2017 15:48
@danwalmsley fix for #1221 here: AvaloniaUI/Avalonia#1223
yay!
danwalmsley
@danwalmsley
Oct 14 2017 15:55
ok will test that out
quite a lot of nice fixes last few days!
Krutonium
@Krutonium
Oct 14 2017 16:02
So... Is there any implementation of Material Design on Avalonia?
danwalmsley
@danwalmsley
Oct 14 2017 16:05
not exactly but its completely lookless so you can create styles and templates to implement that
Jeremy Koritzinsky
@jkoritzinsky
Oct 14 2017 16:05
Not yet. Setting up default-provided theming for different design principles is down the road for us atm.
Krutonium
@Krutonium
Oct 14 2017 16:06
Is there any existing themes/styles that I could easily implement to replace the default lookless?
Jeremy Koritzinsky
@jkoritzinsky
Oct 14 2017 16:21
If you look in Avalonia.Themes.Default in our repo you can see our default styles. They're pretty barebones. I think AvalonStudio (Dan's project) has its own styles somewhere in the repo.
I only override colours and borders mostly
And scrollbar is fairly custom, but will submit a pr to avalonia soon
danwalmsley
@danwalmsley
Oct 14 2017 16:33
ok popping out for a bit
but if anyone wants to press the merge button on #1223 when its passed CI, iv tested it and all works perfectly
:)