These are chat archives for AvaloniaUI/Avalonia

17th
May 2016
Fei
@flyingxu
May 17 2016 01:10
How soon can we get the VS extension/designer work? I installed it and it works with the alpha version, but it doesn't work with the latest source code, and every time I stop debugging, VS hangs for a while.
Fei
@flyingxu
May 17 2016 03:14

Hi, How can I bind Items to a TabControl? Here is what I have, I think it's very close:

    <TabControl>
      <TabControl.TabStrip Items ="{Binding Path = Groups}">
         <TabControl.TabStrip.DataTemplates>
           <DataTemplate DataType ="vm:Group">
            <v:Group></v:Group>
           </DataTemplate>
         </TabControl.TabStrip.DataTemplates>
      </TabControl.TabStrip>
    </TabControl>

But it does not work, there is an exception when creating the control.

I think Avalonia's TabControl is different from WPF, a short xaml example is needed at docs\tutorial\from-wpf.md
Jeremy Koritzinsky
@jkoritzinsky
May 17 2016 04:05
@grokys Figured out a way to do it. I'm just pulling the data from the rendering code and sending it to BoundsTracker.
Wiesław Šoltés
@wieslawsoltes
May 17 2016 06:14
@flyingxu Try this:
<DockPanel>
    <TabStrip Name="groups" Items="{Binding Groups}" DockPanel.Dock="Top">
        <TabStrip.DataTemplates>
            <DataTemplate DataType="vm:Group">
                <TextBlock Text="{Binding}" Margin="2"/>
            </DataTemplate>
        </TabStrip.DataTemplates>
    </TabStrip>
    <ContentControl Content="{Binding #groups.SelectedItem}">
        <ContentControl.DataTemplates>
            <DataTemplate DataType="vm:Group">
                <TextBlock Text="{Binding}"/>
            </DataTemplate>
        </ContentControl.DataTemplates>
    </ContentControl>
</DockPanel>
Steven Kirk
@grokys
May 17 2016 06:52
@flyingxu yeah we currently have a problem with binding TabControl.Items - you have to use the TabStrip/ContentControl workaround that @wieslawsoltes gave
Fei
@flyingxu
May 17 2016 06:55
@wieslawsoltes @grokys I tried and the workaround works, Thanks a lot!
Steven Kirk
@grokys
May 17 2016 06:56
@flyingxu i added an issue so we can track the problem AvaloniaUI/Avalonia#536
Fei
@flyingxu
May 17 2016 06:56
@grokys Thanks you
Matthijs ter Woord
@mterwoord
May 17 2016 06:57
Curious, what does the # syntax mean in bindings?
Steven Kirk
@grokys
May 17 2016 06:57
it's short for "bind to element name"
Fei
@flyingxu
May 17 2016 06:58
Actually I think the solution is pretty cool, I never thought I can use TabStrip/ContentControl that way, maybe it could be the default implementation of TabControl ? :-) @grokys @wieslawsoltes
Steven Kirk
@grokys
May 17 2016 06:58
unfortunately it's not that easy :(
i wish that it were
Fei
@flyingxu
May 17 2016 06:59
@grokys @mterwoord I have the same question as to # syntax, is it in WPF as well or just introduced in Avalonia/OmniXAML?
Matthijs ter Woord
@mterwoord
May 17 2016 07:00
@flyingxu Not sure on wpf, but I have never seen it used there.. so i'm guessing OmniXAML only
Steven Kirk
@grokys
May 17 2016 07:00
i hated the <TextBox Text={Binding ElementName=other, Path=Text} syntax - it's too long
<TextBox Text={Binding #other.Text} is just nicer to write
Fei
@flyingxu
May 17 2016 07:00
Cool
Matthijs ter Woord
@mterwoord
May 17 2016 07:01
@grokys I definitely like the syntax, was just asking
Steven Kirk
@grokys
May 17 2016 07:01
yep, understood :)
from http://grokys.github.io/perspex/perspex-alpha3/ : you can also negate bindings with !
Fei
@flyingxu
May 17 2016 07:09
I think I happened to find a bug (or limitation) of OmniXAML: Text="{Binding Path=StringValue}" works, but Text="{Binding Path = StringValue}" does not work, please see the 2 additional white spaces between =
or wait, let me check again in WPF first
Steven Kirk
@grokys
May 17 2016 07:25
yeah that sounds like an omnixaml problem
Fei
@flyingxu
May 17 2016 07:26
@grokys will do.
José Manuel Nieto
@SuperJMN
May 17 2016 14:25
Looked at it! thanks for reporting!
AvaloniaUI, wow :D
danwalmsley
@danwalmsley
May 17 2016 23:58
since new AppBuilder class came in AvalonStudio completely stopped working...
image.png
layout is weird, missing toolbar, and menuitems cant be clicked...