These are chat archives for AvaloniaUI/Avalonia

4th
May 2018
walterlv
@walterlv
May 04 2018 00:39 UTC
I'm very surprised that the original Grid is SO SLOW for 300×3 row/column!!!
Mine is 109ms and the original one is 199,000ms
Florian
@boombuler
May 04 2018 05:45 UTC

Hi, I was just having a look at #1537 and I was wondering why the OLE-Interfaces behave differently on .net core.

I just fixed a bug that the Win32 DragSource is not registered on .net core which then caused an InvalidCastException when trying to invoke a w32 api. at this line: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Windows/Avalonia.Win32/DragSource.cs#L23

It works fine on full .net...
Florian
@boombuler
May 04 2018 05:58 UTC
nevermind got it.
Seems like the definition of System.Runtime.InteropServices.ComTypes.IDataObjectis not correct on .net core...
Florian
@boombuler
May 04 2018 06:04 UTC
PR #1545 should fix it...
Rayyan Tahir
@RayyanTahir
May 04 2018 08:20 UTC
Hey guys, Is there a GroupName property for RadioButton control? That property is used to denote which set of radio buttons belong to one group such that only one of them may be selected at a time.
Rayyan Tahir
@RayyanTahir
May 04 2018 08:34 UTC
Also, I'm getting an exception System.Exception: 'should not happen' when I add the following style in App.Xaml:
<Style Selector="RadioButton.RadioButtonStyle">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate>
              <BulletDecorator Background="White" Cursor="Hand">
                <BulletDecorator.Bullet>
                  <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Height}">
                    <!--Define size of the Bullet-->
                    <!--The two borders-->
                    <Ellipse Name="RadioOuter" Stroke="LightGray" Fill="Transparent"/>
                    <Ellipse Name="RadioMark" Margin="4" IsVisible="False" Stroke="{TemplateBinding Foreground}" Fill="{TemplateBinding Foreground}"/>
                  </Grid>
                </BulletDecorator.Bullet>
                <!--Text element-->
                <TextBlock Margin="3,1,0,0" Foreground="{TemplateBinding Foreground}" FontSize="13">
                  <ContentPresenter />
                </TextBlock>
              </BulletDecorator>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
<Style Selector="RadioButton.RadioButtonStyle:checked">
        <Setter TargetName="RadioMark" Property="IsVisible" Value="True"/>
        <Setter TargetName="RadioOuter" Property="Stroke" Value="#FFADADAD" />
      </Style>
Steven Kirk
@grokys
May 04 2018 08:38 UTC
@RayyanTahir we don't have a GroupName yet - just put the different groups in separate panels
could you add an issue for that exception?
Rayyan Tahir
@RayyanTahir
May 04 2018 08:38 UTC
Okay thanks. Sure I'll post an issue on this
Steven Kirk
@grokys
May 04 2018 08:38 UTC
@walterlv yes I saw you updated the PR with performace updates on large grids!
the performance of your grid is so much better!
i'm not sure how they made the old grid so slow
Rayyan Tahir
@RayyanTahir
May 04 2018 09:02 UTC
@grokys I put three radio buttons in a stack panel, but checking one doesn't uncheck others in the panel. Am I missing something?
Steven Kirk
@grokys
May 04 2018 09:03 UTC
hmm, no, that should work
Rayyan Tahir
@RayyanTahir
May 04 2018 09:04 UTC
image.png
My code:
<StackPanel Name="RadioGroup" Orientation="Horizontal" Margin="0,10,0,0">
              <local:RadioTextButton Name="rbLowUI" Text="Low" Width="90"/>
              <local:RadioTextButton Name="rbMediumUI" Margin="10,0,0,0" Width="105" Text="Medium"/>
              <local:RadioTextButton Name="rbHighUI" Margin="10,0,0,0" Width="60" Text="High"/>
            </StackPanel>
danwalmsley
@danwalmsley
May 04 2018 09:05 UTC
@RayyanTahir is RadioTextButton a usercontrol?
Rayyan Tahir
@RayyanTahir
May 04 2018 09:05 UTC
Yes
danwalmsley
@danwalmsley
May 04 2018 09:05 UTC
I think that might be why
Rayyan Tahir
@RayyanTahir
May 04 2018 09:05 UTC
Ahan
Steven Kirk
@grokys
May 04 2018 09:05 UTC
oh yeah that will be why
assuming the RadioTextButton contains the RadioButton, then the UserControl is the parent
why do you need RadioTextButton?
Rayyan Tahir
@RayyanTahir
May 04 2018 09:06 UTC
Aahh, makes sense
I'll just revert to using the default controls in the stack panel for now.
danwalmsley
@danwalmsley
May 04 2018 09:06 UTC
@RayyanTahir I think you can do
<RadioButton Content="Low" />
to get the same effect
Rayyan Tahir
@RayyanTahir
May 04 2018 09:07 UTC
True
thanks
It works
Steven Kirk
@grokys
May 04 2018 09:11 UTC
or <RadioButton>Low</RadioButton>
danwalmsley
@danwalmsley
May 04 2018 09:11 UTC
does something else happen?
Steven Kirk
@grokys
May 04 2018 09:12 UTC
oh actually yeah that is overridden in Window. and also it's called when the window is shown, not when it's restored
we might not pause rendering when a window is minimized...
can't remember
danwalmsley
@danwalmsley
May 04 2018 09:14 UTC
so its possible nothing gets called on window when its minimized?
activated and deactivated get called
Rayyan Tahir
@RayyanTahir
May 04 2018 09:28 UTC
Is there a way to get Screen width/height? In WPF we would do: SystemParameters.PrimaryScreenWidth or SystemParameters.PrimaryScreenHeight
danwalmsley
@danwalmsley
May 04 2018 09:33 UTC
you can do
Window.Screens
to get screen info...
you need a window object first though
Rayyan Tahir
@RayyanTahir
May 04 2018 09:34 UTC
In which namespace would Window be in?
And is this a Windows only impl?
see here for example
Rayyan Tahir
@RayyanTahir
May 04 2018 09:35 UTC
Got it thanks
Rayyan Tahir
@RayyanTahir
May 04 2018 09:42 UTC
Are there any docs for storyboard animations?
I'm looking to achieve the following for a usercontrol:
<Trigger Property="IsVisible" Value="True">
            <Trigger.EnterActions>
              <BeginStoryboard>
                <Storyboard RepeatBehavior="Forever">
                  <DoubleAnimationUsingKeyFrames
      Storyboard.TargetProperty="RenderTransform.Angle">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.1" Value="30"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.2" Value="60"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.3" Value="90"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.4" Value="120"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.5" Value="150"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.6" Value="180"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.7" Value="210"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.8" Value="240"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.9" Value="270"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:1.0" Value="300"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:1.1" Value="330"/>
                    <DiscreteDoubleKeyFrame KeyTime="0:0:1.2" Value="360"/>
                  </DoubleAnimationUsingKeyFrames>
                </Storyboard>
              </BeginStoryboard>
            </Trigger.EnterActions>
          </Trigger>
danwalmsley
@danwalmsley
May 04 2018 09:48 UTC
@RayyanTahir currently being implemented
AvaloniaUI/Avalonia#1461
@jmacato has more information
Jumar Macato
@jmacato
May 04 2018 09:51 UTC
@RayyanTahir as @danwalmsley said, it's a WIP and it's fundamentally different than WPF's storyboards, ours is bit more CSS-like
Rayyan Tahir
@RayyanTahir
May 04 2018 09:51 UTC
I understand, Thank you @danwalmsley and @jmacato :smile:
Jumar Macato
@jmacato
May 04 2018 09:54 UTC
and it only works for pseudoclasses for now, i havent figured out yet how to properly activate the animations via class selectors.
That storyboard you gave would be like this in my proposed PR :
wait let me type the example code
      <Style Selector="Border#namehere:pointerover">
        <Style.Animations>
          <Animation Duration="0:0:1" 
                     RepeatBehavior="Loop">
            <TransformKeyFrames Property="RotateTransform.Angle">
              <KeyFrame Cue="0%" Value="0"/>
              <KeyFrame Cue="100%" Value="360"/> 
            </TransformKeyFrames> 
          </Animation>
        </Style.Animations>
      </Style>
something like that perhaps? :)
Rayyan Tahir
@RayyanTahir
May 04 2018 09:57 UTC
NICE! Can't wait till your PR is approved
Also I believe the pseudoclass would be :visible
Because I need it to animate in a loop as soon as it is rendered
Jumar Macato
@jmacato
May 04 2018 09:58 UTC
You can try it out now since all the needed animations code are implemented, and that code will work
Rayyan Tahir
@RayyanTahir
May 04 2018 09:58 UTC
Okay, trying
Portable.Xaml.XamlObjectWriterException: Cannot set unknown member '{clr-namespace:Avalonia.Styling;assembly=Avalonia.Styling}Style.Animations'
Jumar Macato
@jmacato
May 04 2018 10:00 UTC
it's not yet in the main repo, sorry!
Rayyan Tahir
@RayyanTahir
May 04 2018 10:00 UTC
Hmmm, I'll save the code for now, will wait for your PR to be in the main repo
Jumar Macato
@jmacato
May 04 2018 10:03 UTC
sorry for the misleading message, what i meant was you can try it if you can build my animations branch of Avalonia but i'd advise against it since it hasn't been properly tested yet
Rayyan Tahir
@RayyanTahir
May 04 2018 10:04 UTC
That's alright, Thank you, I'll give it a try soon
Steven Kirk
@grokys
May 04 2018 10:05 UTC
but... having said that... @RayyanTahir if you did want to check out the Avalonia repository and give animations a spin that would be really helpful input!
Jumar Macato
@jmacato
May 04 2018 10:07 UTC
i agree with sir @grokys , but i'd advise you to use it outside of production code for now, just in case :)
Rayyan Tahir
@RayyanTahir
May 04 2018 10:08 UTC
I'd be happy to give it a run and provide input after I'm done with this other task which I will be done with soon. :smile:
Wiesław Šoltés
@wieslawsoltes
May 04 2018 11:28 UTC
Cannot set unknown member '{clr-namespace:Avalonia.Controls.PanAndZoom;assembly=Avalonia.Controls.PanAndZoom}ZoomBorder.Grid.Row'
Probably this PR AvaloniaUI/Avalonia#1499 broke setting attached properties on derived controls.
Like public class ZoomBorder : Borderand <paz:ZoomBorder Grid.Row="4" Grid.Column="1"> will cause the above exception.
When I remove Grid.Row="4" Grid.Column="1" there is no exception.
Rayyan Tahir
@RayyanTahir
May 04 2018 11:40 UTC
@jmacato I got your repo, did a cake build, and imported the nupkg's in my project, but I'm still getting: : 'Cannot set unknown member '{clr-namespace:Avalonia.Styling;assembly=Avalonia.Styling}Style.Animations''.
Jumar Macato
@jmacato
May 04 2018 11:41 UTC
cake builds are not reliable for the moment
try building samples/RenderTest first
Rayyan Tahir
@RayyanTahir
May 04 2018 11:41 UTC
Okay
Jumar Macato
@jmacato
May 04 2018 11:43 UTC
then test the animations xaml codes in RenderTest project :)
Rayyan Tahir
@RayyanTahir
May 04 2018 11:44 UTC
Haha, Okay, can the cake builds be made reliable?
Jumar Macato
@jmacato
May 04 2018 11:46 UTC
yes but no one has the time to fix it yet ;)
danwalmsley
@danwalmsley
May 04 2018 11:48 UTC
@RayyanTahir I have a script in scripts/ReplaceNugetCache.ps1
if you build the repo with @jmacato mods
then run ReplaceNugetCache.ps1 [insert-nugget-package-version-here]
you will be able to run your app against the modded dlls
without having to change your nugget package references, etc
Rayyan Tahir
@RayyanTahir
May 04 2018 11:49 UTC
Nice, I'll run that
Wiesław Šoltés
@wieslawsoltes
May 04 2018 11:54 UTC
@grokys AvaloniaUI/Avalonia#1548
Steven Kirk
@grokys
May 04 2018 12:05 UTC
ah ok - yeah looks like that was introduced recently
will fix asap
Wiesław Šoltés
@wieslawsoltes
May 04 2018 12:07 UTC
That would be great!
walterlv
@walterlv
May 04 2018 12:16 UTC
image.png
@grokys I'm confused how the WPF calculate this result!
By solving this situation, my Grid will make the Calendar laying out well.
Rayyan Tahir
@RayyanTahir
May 04 2018 12:20 UTC
@danwalmsley after building @jmacato 's repo I ran your script with arg 0.6.1 and ran my project but it still gives : 'Cannot set unknown member '{clr-namespace:Avalonia.Styling;assembly=Avalonia.Styling}Style.Animations''
Jumar Macato
@jmacato
May 04 2018 12:20 UTC
are you sure you're using the wip-animations branch?
also cleanout the bin and obj in your target project, to pull the cache
Rayyan Tahir
@RayyanTahir
May 04 2018 12:22 UTC
Oops I was using your master branch my bad :smile:
Jumar Macato
@jmacato
May 04 2018 12:22 UTC
haha it's alright :) clean your project anyway just to be sure
Rayyan Tahir
@RayyanTahir
May 04 2018 12:23 UTC
Will do, thanks man
Rayyan Tahir
@RayyanTahir
May 04 2018 12:29 UTC
That worked @jmacato , but when I run your provided code I get: System.Exception: 'Unsupported property Angle'
Also there was an exception about loading *.ico file as icon in Window - Just FYI
Jumar Macato
@jmacato
May 04 2018 12:30 UTC
yeah i havent pulled from main in a while
hmm
double check the selectors, make sure the control exists
also we dont have the :visible pseudoclass :(
Rayyan Tahir
@RayyanTahir
May 04 2018 12:31 UTC
I know :worried:
So my selector is Selector="Image.Loader:pointerover"
and Image control is: <Image Name="LoaderImage" Source="resm:OneScreenSwap.Assets.loading.png" Classes="Loader"/>
Jumar Macato
@jmacato
May 04 2018 12:33 UTC
ah yeah sorry i forgot to tell
you should add a transform object
in that control
something like this:
<Image.RenderTransform>
              <RotateTransform/>
</Image.RenderTransform>
Rayyan Tahir
@RayyanTahir
May 04 2018 12:35 UTC
Oh okay
Jumar Macato
@jmacato
May 04 2018 12:35 UTC
same as wpf, on that regard anyway
Rayyan Tahir
@RayyanTahir
May 04 2018 12:36 UTC
Same exception appears: System.Exception: 'Unsupported property Angle' :smile:
Even though the animation does appear in XAML designer
But at app startup it crashes with that exception
Jumar Macato
@jmacato
May 04 2018 12:40 UTC
what configuration are you in?
Rayyan Tahir
@RayyanTahir
May 04 2018 12:40 UTC
x86
Jumar Macato
@jmacato
May 04 2018 12:41 UTC
debug or release?
Rayyan Tahir
@RayyanTahir
May 04 2018 12:41 UTC
debug
Jumar Macato
@jmacato
May 04 2018 12:42 UTC
i'll be right back, i'm going to bootup to windows
Rayyan Tahir
@RayyanTahir
May 04 2018 12:42 UTC
ok
Jumar Macato
@jmacato
May 04 2018 12:43 UTC
does the rendertest sample project works?
Rayyan Tahir
@RayyanTahir
May 04 2018 12:43 UTC
Yeah that works with some very nice animations btw
Jumar Macato
@jmacato
May 04 2018 12:44 UTC
hmm take a look at RenderTest/Pages/AnimationsPage.xaml as an example :)
Rayyan Tahir
@RayyanTahir
May 04 2018 12:47 UTC
That's strange, I copied the animation code to one of your examples in RenderTest/Pages/AnimationsPage.xaml and it is animating fine
Jumar Macato
@jmacato
May 04 2018 12:49 UTC
hmm the prior code i gave you might be wrong :( just make that AnimationsPage.xaml as your guide for now
Rayyan Tahir
@RayyanTahir
May 04 2018 12:50 UTC
Its not wrong, because I copied it over to AnimationsPage.xaml and the animation worked perfectly, Even at my end the XAML designer is rendering the animations but when I start the application I get the exception.
Jumar Macato
@jmacato
May 04 2018 12:51 UTC
can you give the call stack? i'll see if i can repro that here
Rayyan Tahir
@RayyanTahir
May 04 2018 12:52 UTC
at Avalonia.Animation.Keyframes.TransformKeyFrames.Apply(Animation animation, Animatable control, IObservable`1 obsMatch)
   at Avalonia.Animation.Animation.Apply(Animatable control, IObservable`1 matchObs)
   at Avalonia.Styling.Style.Attach(IStyleable control, IStyleHost container)
   at Avalonia.Styling.Styles.Attach(IStyleable control, IStyleHost container)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control, IStyleHost styleHost)
   at Avalonia.Styling.Styler.ApplyStyles(IStyleable control)
   at Avalonia.Controls.Control.ApplyStyling()
   at Avalonia.Controls.Control.InitializeStylesIfNeeded(Boolean force)
   at Avalonia.Controls.Control.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
   at Avalonia.Controls.Control.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
   at Avalonia.Controls.Control.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
   at Avalonia.Controls.Control.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
   at Avalonia.Controls.Control.Avalonia.Controls.ISetLogicalParent.SetParent(ILogical parent)
   at Avalonia.Controls.Control.SetLogicalParent(IEnumerable`1 children)
   at Avalonia.Controls.Control.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(IList t, Int32 index)
   at Avalonia.Collections.AvaloniaList`1.InsertRange(Int32 index, IEnumerable`1 items)
   at Avalonia.Controls.Panel.ChildrenChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at Avalonia.Collections.AvaloniaList`1.NotifyAdd(IList t, Int32 index)
   at Avalonia.Collections.AvaloniaList`1.Add(T item)
   at OneScreenSwap.Views.MainWindow..ctor() in C:\Projects\SwapProxy\trunk\SwapClient\OneScreenSwap\OneScreenSwap\OneScreenSwap\Views\MainWindow.xaml.cs:line 38
Jumar Macato
@jmacato
May 04 2018 12:57 UTC
@RayyanTahir I sent you a pm
Jumar Macato
@jmacato
May 04 2018 13:16 UTC
okay, so @RayyanTahir has found a quite wonderful bug, setting a styles animations on App.xaml level

will trigger the animations apply (which is dependent on the style setter triggers) logic on the wrong controls.

Setting the style animations inline or in the same xaml file as the target makes it work as intended.

lindexi
@lindexi
May 04 2018 13:16 UTC
Anyone care the Grid layout?
walterlv
@walterlv
May 04 2018 13:25 UTC
@lindexi thx
Rayyan Tahir
@RayyanTahir
May 04 2018 13:34 UTC
I'm unexpectedly getting the following exception at startup:
: 'Could not convert object 'resm:OneScreenSwap.Assets.icon.ico' (of type System.String) to {clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls}WindowIcon: Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'
danwalmsley
@danwalmsley
May 04 2018 14:27 UTC
@RayyanTahir is that a caught or uncaught exception
iv seen that but then it recovers
if it crashes the app then we need to look at it
Rayyan Tahir
@RayyanTahir
May 04 2018 14:28 UTC
Its an unhandled exception and yes it crashes the application when a window loads with Icon set
danwalmsley
@danwalmsley
May 04 2018 14:29 UTC
it could just be an error on @jmacato branch?
because icon loading is working on master
Rayyan Tahir
@RayyanTahir
May 04 2018 14:29 UTC
At first it was, but when I restored the packages from nuget it persisted
danwalmsley
@danwalmsley
May 04 2018 14:30 UTC
how did you restore
?
Rayyan Tahir
@RayyanTahir
May 04 2018 14:30 UTC
I even did a clean build
danwalmsley
@danwalmsley
May 04 2018 14:30 UTC
you need to go into the .nugget folder
and delete all the folders beginning with Avalona.*
Rayyan Tahir
@RayyanTahir
May 04 2018 14:30 UTC
Oh okay
I didn't do that befre
danwalmsley
@danwalmsley
May 04 2018 14:30 UTC
after you used the ReplaceNuget script
Rayyan Tahir
@RayyanTahir
May 04 2018 14:30 UTC
Got it
danwalmsley
@danwalmsley
May 04 2018 14:30 UTC
otherwise restore keeps modified versions
Rayyan Tahir
@RayyanTahir
May 04 2018 14:31 UTC
Hmm