These are chat archives for AvaloniaUI/Avalonia

12th
Dec 2017
danwalmsley
@danwalmsley
Dec 12 2017 09:40
@grokys thanks for the update on #1271
I mean #1284
Steven Kirk
@grokys
Dec 12 2017 09:43
np, does it make sense?
not sure what to do about ItemsControls with no ItemsPresenter...
danwalmsley
@danwalmsley
Dec 12 2017 09:45
is it practical to throw an exception?
I was completely unaware of that
might explain some weird issues iv had with it
is there an example of how ItemsControl with an ItemsPresenter, ListBox perhaps?
I'm just testing and ill get it merged
danwalmsley
@danwalmsley
Dec 12 2017 09:50
im not sure how this selector will work though now!
<Style Selector="cont|DocumentTabControl /template/ TabStripItem:pointerover /template/ Button">
<Setter Property="IsVisible" Value="True" />
</Style>
so this is where pointerover on TabStripItem
was triggering the button to change
visibility
might need a different aproach
can I use a style to set a class?
so that other selectors can then pick it up?
Sergey
@PurpleGray
Dec 12 2017 09:56
As I see in sources, StringFormat for Binding is not implemented in Avalonia. Is this feature was just deemed unnecessary or I can Bind text with formatting from xaml?
danwalmsley
@danwalmsley
Dec 12 2017 09:56
might be nice to support a selector like this...
cont|DocumentTabControl /template/ TabStripItem:selected /Button:pointerover
TabstripItem:Selected then the / indicates jump out of template to content?
danwalmsley
@danwalmsley
Dec 12 2017 10:04
anyway I can work around this for now
@kekekeks should I be worried about this?
image.png
Steven Kirk
@grokys
Dec 12 2017 10:12
not sure a "jump out of template to content" selector would work...
"jump out of template to content" would just be "use logical tree"
@Stratocast3r no, i think it would be useful, it's just not implemented yet
to be honest though i don't really like StringFormat - i'd prefer something like Text="Your name is {{Name}}" like in polymer for example
Sergey
@PurpleGray
Dec 12 2017 10:14
++
danwalmsley
@danwalmsley
Dec 12 2017 10:16
@grokys so its not possible to have a selector which reads a condition on 1 control, but applies it to a different one,
that was just working because of a bug right?
Steven Kirk
@grokys
Dec 12 2017 10:17
yeah that's definitely possible, Panel.foo Button for example checks for the foo class on a Panel and applies the style to a Button child
danwalmsley
@danwalmsley
Dec 12 2017 10:17
ok
Steven Kirk
@grokys
Dec 12 2017 10:18
your problem is that the logical tree is broken, look in devtools
Sergey
@PurpleGray
Dec 12 2017 10:18
DataTemplateSelector impl is planned too?
Steven Kirk
@grokys
Dec 12 2017 10:18
that's why i was thinking that it might be a good idea to throw when that happens
@Stratocast3r i don't think DataTemplateSelector should be needed with avalonia
it might be needed though. an example of why you need it would be useful
i've never even used that in WPF tbh
danwalmsley
@danwalmsley
Dec 12 2017 10:20
Sergey
@PurpleGray
Dec 12 2017 10:23
@grokys Im porting one wpf app. I got TreeView which shows some Project structure, if no Project is loaded, will be shown another template (Centered TextBlock with text "Open or create new project..." for example). Ofc I can do this by codebehind, just wonder about Avalonia's approarch to do it other ways.
Steven Kirk
@grokys
Dec 12 2017 10:25
@danwalmsley oh you had to bring up TabControl didn't you ;) TabControl needs to be :fire: - i can't even remember how i hacked around the problem there
@Stratocast3r are you using MVVM?
if so the way i'd usually do that is by setting a Content property on a view model to either OpenCreateNewProjectViewModel or ProjectStructureViewModel for example
@danwalmsley i think you might be able to make your logical tree work again by returning null from CreateItemContainerGenerator() like TabControl
but TabControl doesn't work with DataTemplates
so it's a crappy solution
Sergey
@PurpleGray
Dec 12 2017 10:29
@grokys Yes, im using mvvm, ok, ty for advice
Steven Kirk
@grokys
Dec 12 2017 10:30
but @Stratocast3r in avalonia you can write your own DataTemplate logic which could do the same as a DataTemplateSelector
or check out the FuncDataTemplate class for a version where you can just pass lambdas to match and create data templates
danwalmsley
@danwalmsley
Dec 12 2017 10:36
@grokys
protected override IItemContainerGenerator CreateItemContainerGenerator()
        {
            return null;
        }
that didn't fix my logical tree
I think over christmas I'll get round to trying to re-write some kind of tabcontrol equivalent
Steven Kirk
@grokys
Dec 12 2017 10:38
that would be great. i've tried multiple times and failed
it's such a weird control
but yeah looking more closely, the reason TabControl's logical tree works is that you have to add TabItems as its children, for anything else the logical tree will break there too
i think basically TabControl needs not to be an ItemsControl
danwalmsley
@danwalmsley
Dec 12 2017 10:41
yeah, and the properties we use from ItemsControl we can manually re-implement for TabControl anyway
in my case I don't need virtualization or anything
but I guess some people might
Steven Kirk
@grokys
Dec 12 2017 10:41
if you're going to write a TabControl replacement, i'd start off by working out how the logical tree should look
danwalmsley
@danwalmsley
Dec 12 2017 10:41
that could be added later I suppose
ok
I guess things like
Steven Kirk
@grokys
Dec 12 2017 10:42
and making it so you can style both tabs and content using that logical tree
danwalmsley
@danwalmsley
Dec 12 2017 10:42
is the tabheader and the tabcontent both in the logical tree?
in my "version" of tab control that you saw in the repro
Steven Kirk
@grokys
Dec 12 2017 10:42
that's the question
danwalmsley
@danwalmsley
Dec 12 2017 10:43
id done some messy "tab headers" are a content presenter,
and you have a header content property
and then content property is same as normal tab control
then user can define
ItemTemplate
HeaderTemplate
Steven Kirk
@grokys
Dec 12 2017 10:45
the important thing would be e.g. what is the selector you need for
  1. setting FontSize of header text
  2. setting FontSize of tab content
Nikita Tsukanov
@kekekeks
Dec 12 2017 12:51
@danwalmsley some bitmaps aren't getting disposed
That shouldn't be printed in Release build
@grokys see screeenshot from @danwalmsley
deferred renderer doesn't dispose layers for some reason
Steven Kirk
@grokys
Dec 12 2017 14:20
@danwalmsley could you file a bug?
danwalmsley
@danwalmsley
Dec 12 2017 14:30
sure, iv no idea how to trigger that!
danwalmsley
@danwalmsley
Dec 12 2017 14:49
@grokys can #1285 be merged?
Steven Kirk
@grokys
Dec 12 2017 14:49
yep!
Steven Kirk
@grokys
Dec 12 2017 21:02
hey could i get a review on #1295 please somebody? it should fix #1247 (and not break other things)
Nikita Tsukanov
@kekekeks
Dec 12 2017 21:13
+
Steven Kirk
@grokys
Dec 12 2017 21:47
@kekekeks how do i use gtk3 on windows? are they docs for that?
Nikita Tsukanov
@kekekeks
Dec 12 2017 21:52
You need to get GTK binaries from somewhere
And add them to PATH
Then it should work out of the box
Haven't checked that for quite a while though
Most of our GTK-related issues are linux-only