These are chat archives for AvaloniaUI/Avalonia

2nd
Mar 2016
Darnell Williams
@Seeker1437
Mar 02 2016 01:11
@danwalmsley I thought you had a somewhat working virtualization for your textview?
Darnell Williams
@Seeker1437
Mar 02 2016 04:22
Idk if y
Idk if you guys have heard of alive, but imagine being able to unit test your code as you are writing it? You can pass in test data and Alive will evaluate you code as you write it and show you the feedback very very quicky. Love it, and wud use it if I had a job. LOL XD I was using it to test out my packet class, as wel as my installer and config editor logic and I found some bugs that would have went production. XD You guys might
Like it.
Denis Zaporozhets
@QuantumDeveloper
Mar 02 2016 06:50
12170 lines? Hindoo is crazy
Steven Kirk
@grokys
Mar 02 2016 09:25
This message was deleted
Nikita Tsukanov
@kekekeks
Mar 02 2016 09:48
Meanwhile someone got 1.15M RPS with vNext
Denis Zaporozhets
@QuantumDeveloper
Mar 02 2016 12:56
@grokys I continue disassembling Grid measure algorithm and noticed that it expand star rows/cols before auto rows/cols actually calculated, which is strange, because star rows/cols should be measure after pixel and auto are measured. Am I right?
Darnell Williams
@Seeker1437
Mar 02 2016 13:15
No thats right to me, star has higher priority than auto, its like weight on android
Steven Kirk
@grokys
Mar 02 2016 13:20
yeah, i think you're right @QuantumDeveloper - star rows should expand to fill the available space after auto rows have been measured
Denis Zaporozhets
@QuantumDeveloper
Mar 02 2016 13:26
so, I think that algorithm is broken
at least its more looks like a brute force than a normal measuring algorithm
that is such a good idea!
Nikita Tsukanov
@kekekeks
Mar 02 2016 15:06
lol
bitbonk
@bitbonk
Mar 02 2016 15:19
@grokys I wouldn't want to take a dependency on one of those nuget packages if I just need one or two methods
Steven Kirk
@grokys
Mar 02 2016 15:19
sure, but if you're using lots like we are, it's probably worth it
and also it's unlikely to add much to the size of your executable as they're just metatdata definitions
(i'm guessing)
Nikita Tsukanov
@kekekeks
Mar 02 2016 15:25
Well, I had that win32.tlb for VB6
It contained definitions for everything
I miss those days
Steven Kirk
@grokys
Mar 02 2016 15:44
ok, i think i'm ready to merge the style-resources branch - it's not finished (what is finished around here...) but it should at least help @danwalmsley
Steven Kirk
@grokys
Mar 02 2016 16:22
ok, merged to master
@danwalmsley @wieslawsoltes you will need to add the default theme import and the default light color theme import to your App.paml:
<Application xmlns="https://github.com/perspex">
  <Application.Styles>
    <StyleInclude Source="resm:Perspex.Themes.Default.DefaultTheme.paml?assembly=Perspex.Themes.Default"/>
    <StyleInclude Source="resm:Perspex.Themes.Default.Accents.BaseLight.paml?assembly=Perspex.Themes.Default"/>
  </Application.Styles>
</Application>
i'm also going to remove the non-xaml test application
ah.. except i can't as the android and iOS test applications use it
balls
Nikita Tsukanov
@kekekeks
Mar 02 2016 16:27
Why do you want to remove it?
Steven Kirk
@grokys
Mar 02 2016 16:27
because it's unmaintained and broken
Nikita Tsukanov
@kekekeks
Mar 02 2016 16:27
Ehm
It worked last time I've checked
It's been a while through
Steven Kirk
@grokys
Mar 02 2016 16:29
i'm sure i can get it working again, but it keeps breaking
because i'm using xaml these days to define UIs
it seems a bit silly to have two
Steven Kirk
@grokys
Mar 02 2016 16:36
ok, i've fixed it
but i would like to remove it sooner or later - it's a throwback to the times before we had xaml
danwalmsley
@danwalmsley
Mar 02 2016 17:08
@grokys Avalon studio didn't have an App.paml
and just adding one hasn't worked
how does my program know how to initialize App.paml?
            Styles.Add(new DefaultTheme());

            var loader = new PerspexXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Perspex.Themes.Default.Accents.BaseLight.paml?assembly=Perspex.Themes.Default"));
            Styles.Add(baseLight);
            Styles.Add(new TextEditorTheme());
            Styles.Add(new MetroWindowTheme());
ah needed this :D
all working thanks will have a play tonight if I have time.
Steven Kirk
@grokys
Mar 02 2016 17:14
yeah, you can add it in code like that, but it's a bit ugly
it'd be better to add an App.paml
you can look at BindingTest for an example of how to add one https://github.com/Perspex/Perspex/tree/master/samples/BindingTest
(btw there you can also see how to add logging)
if you want one, and you're having difficulty adding one i can submit a PR
but it probably won't be today
Wiesław Šoltés
@wieslawsoltes
Mar 02 2016 19:21

@danwalmsley @wieslawsoltes you will need to add the default theme import and the default light color theme import to your App.paml:

@grokys No problem

@grokys What have changed in bindings after last merge ?
Steven Kirk
@grokys
Mar 02 2016 19:22
ah yeah, forgot to say - hopefully now bindings should work with your behaviors
or did you mean that you have a problem?
Wiesław Šoltés
@wieslawsoltes
Mar 02 2016 19:22
no problems :)
now this works
                <Grid RowDefinitions="Auto,100">
                    <TextBox Name="textBox" Text="Hello" Grid.Row="0"/>
                    <Button Name="button" Content="Change Property" Grid.Row="1">
                        <i:Interaction.Behaviors>
                            <ia:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button}">
                                <ia:ChangePropertyAction TargetObject="{Binding ElementName=textBox}" PropertyName="Text" Value="World"/>
                            </ia:EventTriggerBehavior>
                        </i:Interaction.Behaviors>
                    </Button>
                </Grid>
Steven Kirk
@grokys
Mar 02 2016 19:24
coool! i was hoping it would (though i didn't actually test it)
danwalmsley
@danwalmsley
Mar 02 2016 19:24
grokys
Wiesław Šoltés
@wieslawsoltes
Mar 02 2016 19:24
yep we have open source xaml behaviors before WPF :D
danwalmsley
@danwalmsley
Mar 02 2016 19:24
how should it work when I have a theme for my texteditor in a seperate assembly
do I still need them to be loaded by app.cs
?
Steven Kirk
@grokys
Mar 02 2016 19:25
well themes are currently in a different assembly - note the URL: https://github.com/Perspex/Perspex/blob/master/samples/BindingTest/App.paml#L3
danwalmsley
@danwalmsley
Mar 02 2016 19:25
yes, however App.cs wont know about them until runtime
when MEF injects the plugin
Steven Kirk
@grokys
Mar 02 2016 19:26
ok, so you'll have to load them then
not sure what you're asking
danwalmsley
@danwalmsley
Mar 02 2016 19:27
ah ok I see
about the designer
could it just run the assembly, generate the ui, then grab an image of it and display the image
and immediately teminate the process
that way I wont have to resstart VS all the time
because the designer is blocking compiling by holding the files open
Steven Kirk
@grokys
Mar 02 2016 19:34
yeah, i'm finding that a lot too
in fact i don't use the designer any more because of that problem
danwalmsley
@danwalmsley
Mar 02 2016 19:34
yeh
if it takes an image, then it would not be running 99% of time
Steven Kirk
@grokys
Mar 02 2016 19:34
i suspect it would be really slow though
Wiesław Šoltés
@wieslawsoltes
Mar 02 2016 19:35
anyone interested in Xaml Behaviors for Perspex please feel free to test them https://github.com/XamlBehaviors/XamlBehaviors
danwalmsley
@danwalmsley
Mar 02 2016 19:39
@grokys iv tried to change a theme colour
i think the actual control is a Border
but none of the theme resources seem to override it
Steven Kirk
@grokys
Mar 02 2016 19:41
errr, not sure what you mean - Borders aren't templated controls
danwalmsley
@danwalmsley
Mar 02 2016 19:41
so it would just default to white?
Steven Kirk
@grokys
Mar 02 2016 19:41
i have no idea what you're talking about ;)
Jeremy Koritzinsky
@jkoritzinsky
Mar 02 2016 19:41
Any chance there's a way to add handlers to routed events in XAML?
danwalmsley
@danwalmsley
Mar 02 2016 19:41
 <ControlTemplate>
        <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
          <AdornerDecorator>
            <Grid Margin="{TemplateBinding !BorderThickness}" ColumnDefinitions="Auto, *, Auto" RowDefinitions="Auto,Auto,*,Auto,Auto" Background="Transparent">
ah Background here needs to reference styleresource?
Steven Kirk
@grokys
Mar 02 2016 19:42
@jkoritzinsky sorry, OmniXaml doesn't support event handlers in XAML yet
Jeremy Koritzinsky
@jkoritzinsky
Mar 02 2016 19:43
Thought so. I had tried and just kept getting errors...
Steven Kirk
@grokys
Mar 02 2016 19:43
i'm not sure what you're trying to do dan, but i'm pretty sure you're on the wrong track
that has your dark theme colors in it
then include that file instead of the BaseLight file
danwalmsley
@danwalmsley
Mar 02 2016 19:43
yes, its just I have my own version of window
and first thing I tried to do is override the background
but obviously iv just realised I had to update my Window Template
iv created a BaseDark
Steven Kirk
@grokys
Mar 02 2016 19:44
ah ok
danwalmsley
@danwalmsley
Mar 02 2016 19:44
im getting there bit by bit
@jkoritzinsky yeah - feel free to add a +1 to SuperJMN/OmniXAML#10
danwalmsley
@danwalmsley
Mar 02 2016 19:46
@grokys thanks its working now
Steven Kirk
@grokys
Mar 02 2016 19:46
cool!
danwalmsley
@danwalmsley
Mar 02 2016 19:46
I'd initially tried to replace the background inside the template
Steven Kirk
@grokys
Mar 02 2016 19:46
i realise this is all hard, with no documentation!
danwalmsley
@danwalmsley
Mar 02 2016 19:46
but that has to remain Template Binding
StyleResource
can only be used inside a style right
?
Steven Kirk
@grokys
Mar 02 2016 19:47
no, it can be used anywhere
danwalmsley
@danwalmsley
Mar 02 2016 19:48
ah neat
Steven Kirk
@grokys
Mar 02 2016 19:48
notice that a few lines below i override the resources for a single button
danwalmsley
@danwalmsley
Mar 02 2016 19:52
I reckon in about an hour I can submit a PR for BaseDark :D
this is me converting it at the moment:
blob
Wiesław Šoltés
@wieslawsoltes
Mar 02 2016 20:08
@grokys Would be possible to add Resources property to Application so it can behave same as this
<Application x:Class="Core2D.Perspex.App"
             xmlns="https://github.com/perspex"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Styles>
        <Style>
            <Style.Resources>
                <SolidColorBrush x:Key="BorderBrush">#FFACACAC</SolidColorBrush>
            </Style.Resources>
        </Style>
    </Application.Styles>
</Application>
so I can define my resources:
<Application x:Class="Core2D.Perspex.App"
             xmlns="https://github.com/perspex"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.Resources>
        <SolidColorBrush x:Key="BorderBrush">#FFACACAC</SolidColorBrush>
    </Application.Resources>
</Application>
and then use the resources in <Application.Styles>
danwalmsley
@danwalmsley
Mar 02 2016 20:49
blob
Steven Kirk
@grokys
Mar 02 2016 20:50
Nice!
@wieslawsoltes I'm at dinner at the moment, can we talk about it tomorrow? There was a reason I put the resources in styles and not in the controls themselves but I'm willing to be persuaded
Wiesław Šoltés
@wieslawsoltes
Mar 02 2016 21:05
No problem, we can talk tomorrow
I will open issue so this will not get lost
danwalmsley
@danwalmsley
Mar 02 2016 21:10
@grokys when you get back
iv found that its not picking up border brush or foreground from style resouce on my Window class
Title="AvalonStudio" BorderThickness="1" BorderBrush="{StyleResource ThemeAccentBrush2}" Foreground="{StyleResource ThemeForegroundBrush}" Width="1600" Height="900">
this is in my Mainwindow.paml
but they are being ignored for some reason
or perhaps they are not being inherited by subcontrols like when I manually set them