These are chat archives for AvaloniaUI/Avalonia

3rd
May 2018
Mark Junker
@fubar-coder
May 03 2018 07:29
You can already debug NuGet packages locally when your target framework is netcoreapp2.0. The thing is called SourceLine V2 and the FluentMigrator project already uses this feature :grinning: .
danwalmsley
@danwalmsley
May 03 2018 07:51
@fubar-coder thanks for tip, we also want to be able to build Avalonia with local changes then have a project that normally runs against the nuget packages run against the locally modified build.
Mark Junker
@fubar-coder
May 03 2018 07:53
Hmm, yes, that's always a PITA. My solution was to use GitVersion, a build script and a local NuGet repository. EDIT: … and using a squash before a push.
walterlv
@walterlv
May 03 2018 09:12
@fubar-coder We are debugging local changes, so the NuGet source code is useless. I'm trying local NuGet source in a private project.
danwalmsley
@danwalmsley
May 03 2018 10:23
The replace script works very quickly and easily, but it's a hack, and if you forget to undo it at the end you can be left unknowingly running on modified assemblies
I'm trying to find the docs for how to register StyledProperty change events
danwalmsley
@danwalmsley
May 03 2018 11:49
from memory I think itsthis.GetObservable(PropertyName).Subscibe(observer => ...)`
Rayyan Tahir
@RayyanTahir
May 03 2018 11:50
Okay, thanks
danwalmsley
@danwalmsley
May 03 2018 11:51
yes like this
this.GetObservable(NameProperty).Subscribe(name =>
            {
                Console.WriteLine(name);
            });
Rayyan Tahir
@RayyanTahir
May 03 2018 11:52
Thanks, appreciate it :+1:
danwalmsley
@danwalmsley
May 03 2018 11:52
you can also do
this.GetObservableWithHistory(NameProperty).Subscribe(change =>
            {

            });
if you want to know oldvalue and newvalue
Rayyan Tahir
@RayyanTahir
May 03 2018 11:53
Better
danwalmsley
@danwalmsley
May 03 2018 12:14
@RayyanTahir those methods return IDisposable
so you should call dispose on them at somepoint when you are finished with the subscription to prevent memory leaks
danwalmsley
@danwalmsley
May 03 2018 12:22
@RayyanTahir regarding your issue #1541
can you tell me the locations you put the .XAML and .XAML.cs file inside your project
Rayyan Tahir
@RayyanTahir
May 03 2018 12:23
Sure
danwalmsley
@danwalmsley
May 03 2018 12:23
and paste the xmlns declaration you used and the line in XAML you used your user control
can you also paste contents of csproj file
Rayyan Tahir
@RayyanTahir
May 03 2018 12:23
Sure one sec
Parent UserControl XAML:
<UserControl xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:OneScreenSwap.User_Controls" xmlns:models="clr-namespace:OneScreenSwap.Models" Height="619" Width="553"> <Grid RowDefinitions="28*,12*,50*"> <Grid Grid.Row="0" ColumnDefinitions="30*,40*,30*"> <TextBlock Name="lblConnecting" IsVisible="False" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" FontSize="15" Text="Connecting..." Foreground="Orange"/> <Image Grid.Column="1" VerticalAlignment="Bottom" Source="resm:OneScreenSwap.Assets.onescree-logo.png"/> </Grid> <Grid Grid.Row="1"> <StackPanel Orientation="Vertical" VerticalAlignment="Center"> <TextBlock HorizontalAlignment="Center" FontSize="30" Text="Sign In" Foreground="#325E7C"/> <TextBlock FontSize="15" HorizontalAlignment="Center" Text="to continue using SWAP Publisher" Foreground="#325E7C"/> </StackPanel> </Grid> <Grid Name="GridLoginControl" Grid.Row="2" RowDefinitions="10*,10*,17*,13*,8*"> <Button Name="btnForgotPassword" FontSize="14" Grid.Row="3" Classes="LinkButton" Content="Forgot Password" VerticalAlignment="Top" /> <DockPanel Grid.Row="4" LastChildFill="False"> <Button Name="btnSignUp" DockPanel.Dock="Left" Classes="LinkButton" Margin="15,0,0,0" Content="Sign Up" /> <Button Name="btnFeedback" DockPanel.Dock="Right" Classes="LinkButton" Margin="0,0,15,0" Content="Feedback" /> <Separator Margin="10,0,10,0" Width="1" Background="#DFE8EF" Height="{Binding ElementName=btnAppSettings, Path=ActualHeight}" DockPanel.Dock="Right" /> <Button DockPanel.Dock="Right" Name="btnAppSettings" Classes="LinkButton" Content="App Settings"/> </DockPanel> <Grid Name="gbtnHolder" HorizontalAlignment="Center" Height="50" Margin="0,15,0,0" Grid.Row="2" VerticalAlignment="Top" Width="150"/> <local:LineTextBox Name="txtEmailUI" Hint="Email" TextBoxType="{x:Static models:TextBoxType.Email}" Width="350" Height="30" Grid.Row="0" VerticalAlignment="Bottom"/> <local:LinePasswordBox Name="txtPasswordUI" Hint="Password" TextBoxType="{x:Static models:TextBoxType.Password}" Width="350" Height="30" Grid.Row="1" VerticalAlignment="Bottom"/> </Grid> </Grid> </UserControl>
In the above XAML i'm using user controls LineTextBox and LinePasswordBox at the end
danwalmsley
@danwalmsley
May 03 2018 12:25
@RayyanTahir if you do in gitter
```
then a new line
then paste code
then a newline
and ``` again
Rayyan Tahir
@RayyanTahir
May 03 2018 12:25
Oh okay, i'll do it again
danwalmsley
@danwalmsley
May 03 2018 12:25
you can have indented code like this
test
will be easier to read :)
Rayyan Tahir
@RayyanTahir
May 03 2018 12:26
My bad, let me re-paste
```
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:OneScreenSwap.User_Controls"
             xmlns:models="clr-namespace:OneScreenSwap.Models"
             Height="619" Width="553">
  <Grid RowDefinitions="28*,12*,50*">
    <Grid Grid.Row="0" ColumnDefinitions="30*,40*,30*">
      <TextBlock Name="lblConnecting" IsVisible="False" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" FontSize="15" Text="Connecting..." Foreground="Orange"/>
      <Image Grid.Column="1" VerticalAlignment="Bottom" Source="resm:OneScreenSwap.Assets.onescree-logo.png"/>
    </Grid>
    <Grid Grid.Row="1">
      <StackPanel Orientation="Vertical" VerticalAlignment="Center">
        <TextBlock HorizontalAlignment="Center" FontSize="30" Text="Sign In" Foreground="#325E7C"/>
        <TextBlock FontSize="15" HorizontalAlignment="Center" Text="to continue using SWAP Publisher" Foreground="#325E7C"/>
      </StackPanel>
    </Grid>
    <Grid Name="GridLoginControl" Grid.Row="2" RowDefinitions="10*,10*,17*,13*,8*">
      <Button Name="btnForgotPassword" FontSize="14" Grid.Row="3" Classes="LinkButton" Content="Forgot Password" VerticalAlignment="Top" />
      <DockPanel Grid.Row="4" LastChildFill="False">
        <Button Name="btnSignUp" DockPanel.Dock="Left" Classes="LinkButton" Margin="15,0,0,0" Content="Sign Up" />
        <Button Name="btnFeedback" DockPanel.Dock="Right" Classes="LinkButton" Margin="0,0,15,0" Content="Feedback" />
        <Separator Margin="10,0,10,0" Width="1" Background="#DFE8EF" Height="{Binding ElementName=btnAppSettings, Path=ActualHeight}" DockPanel.Dock="Right" />
        <Button DockPanel.Dock="Right" Name="btnAppSettings" Classes="LinkButton" Content="App Settings"/>
      </DockPanel>
      <Grid Name="gbtnHolder" HorizontalAlignment="Center" Height="50" Margin="0,15,0,0" Grid.Row="2" VerticalAlignment="Top" Width="150"/>
      <local:LineTextBox Name="txtEmailUI" Hint="Email" TextBoxType="{x:Static models:TextBoxType.Email}" Width="350" Height="30" Grid.Row="0" VerticalAlignment="Bottom"/>
      <local:LinePasswordBox Name="txtPasswordUI" Hint="Password" TextBoxType="{x:Static models:TextBoxType.Password}" Width="350" Height="30" Grid.Row="1" VerticalAlignment="Bottom"/>
    </Grid>
  </Grid>
</UserControl>
LineTextBox User Control:
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             Height="30" Width="150">
  <Grid Name="ControlGrid">
    <Border Name="BorderControl" BorderBrush="#C9D4DC" BorderThickness="1">
      <Grid>
        <TextBox Name="txt" Margin="0,0,0,1" FontSize="14" Background="Transparent" Foreground="#325E7C" BorderThickness="0" FontFamily="/Content/Fonts/OpenSans"/>
        <TextBlock Name="lbl" IsVisible="False" Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource TemplatedParent}}" Focusable="True" FontSize="13" Background="White" Foreground="#ED1300"/>
      </Grid>
    </Border>
  </Grid>
</UserControl>
danwalmsley
@danwalmsley
May 03 2018 12:27
ok now I need to see the folder structure of your project
like the solution explorer or something
where those files are
Rayyan Tahir
@RayyanTahir
May 03 2018 12:28
sure taking a snip
image.png
danwalmsley
@danwalmsley
May 03 2018 12:29
firstly can you rename User Controls to get rid of the space
I'm not sure we can cope with that
Rayyan Tahir
@RayyanTahir
May 03 2018 12:29
sure
danwalmsley
@danwalmsley
May 03 2018 12:29
see if that fixes it
you need to change your xml namespace declarations also
Rayyan Tahir
@RayyanTahir
May 03 2018 12:31
Changing the name to UserControls didn't work
danwalmsley
@danwalmsley
May 03 2018 12:33
is the error the same?
Rayyan Tahir
@RayyanTahir
May 03 2018 12:34
Yes,
Portable.Xaml.XamlParseException: Cannot resolve runtime namespace from XML namespace 'clr-namespace:OneScreenSwap.UserControls'
at Avalonia.Markup.Xaml.PortableXaml.AvaloniaXamlSchemaContext.GetXamlType(String xamlNamespace, String name, XamlType[] typeArguments)
at Portable.Xaml.XamlSchemaContext.GetXamlType(XamlTypeName xamlTypeName)
at Portable.Xaml.XamlXmlParser.<ReadObjectElement>d15.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadCollectionItems>d
31.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMember>d30.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMemberElement>d
29.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMembers>d18.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadObjectElement>d
15.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadCollectionItems>d31.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMember>d
30.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMemberElement>d29.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMembers>d
18.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadObjectElement>d15.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMember>d
30.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMemberElement>d29.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadMembers>d
18.MoveNext()
at Portable.Xaml.XamlXmlParser.<ReadObjectElement>d15.MoveNext()
at Portable.Xaml.XamlXmlParser.<Parse>d
13.MoveNext()
at Portable.Xaml.XamlXmlReader.Read()
at Portable.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)
at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.LoadFromReader(XamlReader reader, AvaloniaXamlContext context)
at Avalonia.Markup.Xaml.AvaloniaXamlLoaderPortableXaml.Load(Stream stream, Object rootInstance, Uri uri)
at Avalonia.DesignerSupport.DesignWindowLoader.LoadDesignerWindow(String xaml, String assemblyPath)
at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.<>cDisplayClass17_0.<OnTransportMessage>b0()
danwalmsley
@danwalmsley
May 03 2018 12:35
any chance you are able to zip your code and send for me to have a quick look?
iv had loads of these types of issues before
its usually simple to resolve
Rayyan Tahir
@RayyanTahir
May 03 2018 12:36
Sure, I'll add the project zip in the opened issue #1541
jp2masa
@jp2masa
May 03 2018 12:36
did you specify the assembly?
danwalmsley
@danwalmsley
May 03 2018 12:37
@jp2masa oh yeah well spotted
xmlns:local="clr-namespace:OneScreenSwap.UserControls;assembly=OneScreenSwap
change to that
Rayyan Tahir
@RayyanTahir
May 03 2018 12:37
Oh! Good catch
danwalmsley
@danwalmsley
May 03 2018 12:37
assuming your assembly name is onescreenswap
Rayyan Tahir
@RayyanTahir
May 03 2018 12:38
That worked, Thanks @jp2masa and @danwalmsley :smile:
danwalmsley
@danwalmsley
May 03 2018 12:40
we have an issue opened to fix that at some point
when the XAML is in the same assembly you shouldn't need to specify assembly,
but for now you have to always specify.
Rayyan Tahir
@RayyanTahir
May 03 2018 12:40
Great, I'll close my issue
Felipe
@ffquintella
May 03 2018 13:58
hi guys
I don't know if this is a dumb question but I'm tring to create a new avalon window (for a login page)
and for some reason I can't make it appear as a modal dialog on the front of the main window
does any one knows how to do it ?
Rayyan Tahir
@RayyanTahir
May 03 2018 14:14
@ffquintella Is the modal dialog not showing at all or is it showing behind Main window?
Felipe
@ffquintella
May 03 2018 14:16
behind
I tried to focus on it but for some reason it didn't work .
Rayyan Tahir
@RayyanTahir
May 03 2018 14:20
Well in WPF you have to set the Owner property of child window to the parent window, In Avalonia I think the property name is Parent. so try this:

ChildWindow.Parent = ParentWindow;
Felipe
@ffquintella
May 03 2018 14:20
thanks I will try
Can't do it the Parent property is read only
Rayyan Tahir
@RayyanTahir
May 03 2018 14:24
Ahan, then I guess its not implemented yet
Felipe
@ffquintella
May 03 2018 14:25
hummmm
Rayyan Tahir
@RayyanTahir
May 03 2018 14:25
Have you tried setting the Zindex property for the child window?
Felipe
@ffquintella
May 03 2018 14:26
hummm no
let me check
danwalmsley
@danwalmsley
May 03 2018 14:26
@ffquintella its not implemented yet
ZIndex would only affect stuff inside the window
the only thing you can set as modal is SystemDialogs, like openfile, openfolder, etc
I ran into the same problem a few days ago
I'm not sure but does calling ShowDialog instead of Show make it modal?
in anycase we need to implement setting the parent window
Rayyan Tahir
@RayyanTahir
May 03 2018 14:29
in anycase we need to implement setting the parent window
true
Felipe
@ffquintella
May 03 2018 14:29
no ... it doesn't
it's weird since when opening on a button click
it open in the front of the main window
but when doing ti on the window initialization it is always behind
....
:-/
danwalmsley
@danwalmsley
May 03 2018 14:30
you need to defer it until after the main window has loaded
you could try this
Dispatcher.UIThread.Post (() => ... code to open the dialog );
this means it will get opened after the initial layout and render pass has happened (I think)
if not you can pass a different priority to the post method
Felipe
@ffquintella
May 03 2018 14:33
let me try
danwalmsley
@danwalmsley
May 03 2018 14:35
@ffquintella if I get some spare time I will try to implement modal windows
Felipe
@ffquintella
May 03 2018 14:38
Thanks
Felipe
@ffquintella
May 03 2018 14:55
As strange as it may seem the only way I managed so far to make it appear on top of the main window was using this
        this.PointerEnter += delegate
        {
            HandleLogin();
        };
I had to make some tests on Handle Login to avoid it oppening serveral windows and will only happen when I move the mouse
for some reason the initialized event is never raised
Rayyan Tahir
@RayyanTahir
May 03 2018 14:57
What about PointerPressed event?
Felipe
@ffquintella
May 03 2018 14:57
didn't try
but it will only be raised if I click on the window right ?
Rayyan Tahir
@RayyanTahir
May 03 2018 14:57
PointerPressed is similar to WPF's MouseLeftButtonDown
Felipe
@ffquintella
May 03 2018 14:58
yes
but for me I want to make the illusion of it oppening right after the main window
Rayyan Tahir
@RayyanTahir
May 03 2018 14:58
Oh, I get you
Felipe
@ffquintella
May 03 2018 14:58
the pointer Enter is more imediate on this
Rayyan Tahir
@RayyanTahir
May 03 2018 14:59
hmm
Felipe
@ffquintella
May 03 2018 14:59
any way this is ok for me to continue devoping
thanks for the help
:-)
Benedikt Stebner
@Gillibald
May 03 2018 15:11
Does anyone know how FormattedText works in the GTK3 render path? I can't find any implementation for IFormattedTextImpl.
danwalmsley
@danwalmsley
May 03 2018 15:11
@ffquintella its quite easy to implement on win32
@Gillibald you need to look for the Skia implementation
GTK isn't used for rendering text
Benedikt Stebner
@Gillibald
May 03 2018 15:13
Skia and Direct2D1 is done
That already works
danwalmsley
@danwalmsley
May 03 2018 15:15
but we don't use GTK for rendering
only for window management
or are you trying to implement a new rendering subsystem?
Benedikt Stebner
@Gillibald
May 03 2018 15:18
I am just adding support for custom fonts. Wanted to make sure i didnt miss anything.
danwalmsley
@danwalmsley
May 03 2018 15:18
ah I see
well gtk isn't used for rendering, so I guess you just need to load them into skia
that will handle Linux and windows
Benedikt Stebner
@Gillibald
May 03 2018 15:19
Thought about implementing my own AssetLoader to auto detect typefaces
Just tested skia on windows
Rayyan Tahir
@RayyanTahir
May 03 2018 15:19
@danwalmsley Did you ever encounter an issue in png image rendering on window. It looks too edgy
danwalmsley
@danwalmsley
May 03 2018 15:20
can you post a screenshot?
Rayyan Tahir
@RayyanTahir
May 03 2018 15:20
sure
danwalmsley
@danwalmsley
May 03 2018 15:20
iv noticed my icons can be a bit blocky sometimes
like here
image.png
icon on window is well blocky
but the image seems ok
I used
<Image Source="resm:AvalonStudio.Controls.Standard.AboutScreen.Assets.logo-65.png?assembly=AvalonStudio.Controls.Standard" Stretch="None" Width="65" Height="65" Margin="20" />
Rayyan Tahir
@RayyanTahir
May 03 2018 15:21
That's exactly what I am facing. here's my screenshot:
image.png
danwalmsley
@danwalmsley
May 03 2018 15:22
wow that dialog looks really nice
just the icon top left?
Rayyan Tahir
@RayyanTahir
May 03 2018 15:22
The big circle image is not rendering really nicely
danwalmsley
@danwalmsley
May 03 2018 15:22
what code do you have to display it
I wonder if you are scaling it or something
Rayyan Tahir
@RayyanTahir
May 03 2018 15:22
Thank you! you can see my whole WPF implementation by downloading this application from www.swap.claryicon.com
ill paste code here
danwalmsley
@danwalmsley
May 03 2018 15:23
wow great app
Rayyan Tahir
@RayyanTahir
May 03 2018 15:24
Thankyou
<Image Grid.Column="1" VerticalAlignment="Bottom" Source="resm:OneScreenSwap.Assets.onescree-logo.png"/>
Icon="resm:OneScreenSwap.Assets.icon.ico"
danwalmsley
@danwalmsley
May 03 2018 15:25
Try Stretch="None" on the png
the icon I think we need an issue for this
Rayyan Tahir
@RayyanTahir
May 03 2018 15:26
That fixed it
danwalmsley
@danwalmsley
May 03 2018 15:26
I think @jkoritzinsky implemented loading of icons, he may know why they end up blocky
:)
Rayyan Tahir
@RayyanTahir
May 03 2018 15:26
:smile:
Sorien
@Sorien
May 03 2018 15:26
It looks like using linear scaling method instead of bilinear/bicubic
Jeremy Koritzinsky
@jkoritzinsky
May 03 2018 15:43
@danwalmsley the window icon handling is done by System.Drawing in Win32. @RayyanTahir I'd suggest making your ico file have multiple mipmap levels so it can look good as an icon and as an image.
Rayyan Tahir
@RayyanTahir
May 03 2018 15:45
Alright, thanks @jkoritzinsky
Rayyan Tahir
@RayyanTahir
May 03 2018 15:54
PointerPressed event only triggers when right mouse button is pressed
danwalmsley
@danwalmsley
May 03 2018 15:54
@RayyanTahir its probably that something else is handling left click
what are you clicking on?
Rayyan Tahir
@RayyanTahir
May 03 2018 15:55
Button
danwalmsley
@danwalmsley
May 03 2018 15:55
button handles the left click
did you mean to subscribe to the Button.Click event instead?
or Bind a command to the button?
Rayyan Tahir
@RayyanTahir
May 03 2018 15:57
Yeah, I could go for the Click event, but Is it a bug if the left mouse button is not firing PointerPressed event on a button?
danwalmsley
@danwalmsley
May 03 2018 15:57
no its not a bug
the button is handling the Click event
so you don't get it
Rayyan Tahir
@RayyanTahir
May 03 2018 15:57
Oh I see
Thank you
danwalmsley
@danwalmsley
May 03 2018 15:58
you need to subscribe to the PointerPressed event in a different way if you want to get the pointer pressed
before the button
like this
AddHandler(KeyUpEvent, tunneledKeyUpHandler, RoutingStrategies.Tunnel)
you can use
public enum RoutingStrategies
    {
        Direct = 1,
        Tunnel = 2,
        Bubble=4
from wpf docs

Bubble
The routed event uses a bubbling strategy, where the event instance routes upwards through the tree, from event source to root. 

Direct
The routed event does not route through an element tree, but does support other routed event capabilities such as class handling, EventTrigger or EventSetter. 

Tunnel
The routed event uses a tunneling strategy, where the event instance routes downwards through the tree, from root to source element.
this would allow you to get the click event
Rayyan Tahir
@RayyanTahir
May 03 2018 16:00
Right, so even for the other controls we can't directly assign a delegate to PointerPressed events?
danwalmsley
@danwalmsley
May 03 2018 16:00
yes you can
another control
that doesn't handle the left click
(but a lot do)
so a textblock you could do
or a window
or a panel, etc
if you use a control like button, or textbox, you may need to do this
its the same in wpf
Rayyan Tahir
@RayyanTahir
May 03 2018 16:04
Got you
THanks
Steven Kirk
@grokys
May 03 2018 16:56
same in html for that matter i believe
jp2masa
@jp2masa
May 03 2018 17:34
if I have a custom control (for example MyControl), how can I create a style for it? I tried <Style Selector="MyControl"> and <Style Selector="ns:MyControl"> (this one would be parsed as a pseudo class?), and none of them worked...
Steven Kirk
@grokys
May 03 2018 17:43

@jp2masa http://avaloniaui.net/docs/styles/selectors

To include a XAML namespace in the type separate the namespace and the type with a | character.

jp2masa
@jp2masa
May 03 2018 17:44
thanks, I looked at the wrong page in the docs...
Felipe
@ffquintella
May 03 2018 19:51
Hi guys
another question
do you have a "password" control in avalonia ?
danwalmsley
@danwalmsley
May 03 2018 20:08
@ffquintella unfortunately not
you can make a "cheap" version by making your own password box
@RayyanTahir might have a solution :)
btw iv got modal windows working for windows now
@grokys iv submitted WIP pr AvaloniaUI/Avalonia#1542 for modal windows.
its a slight mod to the IWindowImpl interface to allow it to know when the WindowBase.Owner property was set.
iv implemented it setting the owner in win32.
This means things like when you call Show or ShowDialog, then if the owner window is minimised the owned window is also minimised,
and also keeps the child window in front of the main window
there are 4 different ways of opening a window, so I added a window page to control catalog so we can easily see how they behave
id be grateful to know what you think before I try to implement for Linux and mac
Steven Kirk
@grokys
May 03 2018 20:26
i think we really need to add a password control don't we?
danwalmsley
@danwalmsley
May 03 2018 20:26
there has been several enquiries about it recently
Felipe
@ffquintella
May 03 2018 20:32
@danwalmsley Cool
I already did my own password box
it's working well enoght ;-)
and it's cool to know there is modal windows
danwalmsley
@danwalmsley
May 03 2018 20:33
@ffquintella :smile:
@ffquintella probably will be ready next few days
Felipe
@ffquintella
May 03 2018 20:33
I will download the latest code to test tomorow or tonight if I have time
so hold the password in?
Steven Kirk
@grokys
May 03 2018 20:35
i think the general consensus is that SecureString is overkill for pretty much anything
and it means you need a separate control from TextBox
which means no binding etc
Felipe
@ffquintella
May 03 2018 20:36
yes that would be the ideal
I created a code that replaces what's typed on the textbox with *
and stores the old values on a variable
but it's not perfect
the ideal would be to have a passwordbox
Steven Kirk
@grokys
May 03 2018 20:37
why not TextBox/PasswordChar as in winforms @ffquintella ?
danwalmsley
@danwalmsley
May 03 2018 20:38
@grokys so we don't need to worry about password being inspected via debugger or anything
literally just really simply hide the text
Steven Kirk
@grokys
May 03 2018 20:39
oh, is that really a problem in practise?
danwalmsley
@danwalmsley
May 03 2018 20:39
I guess not
Felipe
@ffquintella
May 03 2018 20:40
well I really didn't cosidered the perfect name just told it would be nice if it existed
@danwalmsley I agree basically what's needed it to hide the text
another good option would be to add a property to textbox something like secure=<true/false>
Steven Kirk
@grokys
May 03 2018 20:41
at some point, you're going to have to have the password in memory, so PasswordBox/SecureString doesn't really protect you from much if an attacker has access to your process afaics
danwalmsley
@danwalmsley
May 03 2018 20:42
I will do a PR with something like the winforms model
Steven Kirk
@grokys
May 03 2018 20:42
that would be great
could you add a description to #1542 so we know what to review?
speaking of which
i'm right now going to add a PR template
danwalmsley
@danwalmsley
May 03 2018 20:46
sorry, updated
Steven Kirk
@grokys
May 03 2018 20:57
i was thinking something like this for a PR template:
This template is not intended to be prescriptive, but to help us review pull requests it would be useful if you included as much of the following information as possible:

- What does the pull request do?
- What is the current behavior?
- What is the updated/expected behavior with this PR?
- How was the solution implemented (if it's not obvious)?

Checklist:

- [ ] Added unit tests (if possible)?
- [ ] Added XML documentation to any related classes?
- [ ] Consider submitting a PR to https://github.com/AvaloniaUI/Avaloniaui.net with user documentation

If the pull request fixes issue(s) list them like this:

Fixes #123
Fixes #456
what do you think? i don't want to make it too paperworky, just trying to remind contributors what info is useful
danwalmsley
@danwalmsley
May 03 2018 20:58
yes I think that's good
Steven Kirk
@grokys
May 03 2018 21:03
ok #1543
ahopper
@ahopper
May 03 2018 21:06
As a previous transgressor that makes complete sense to me :)
danwalmsley
@danwalmsley
May 03 2018 21:06
@grokys approved
Steven Kirk
@grokys
May 03 2018 21:07
great ;) i know @ahopper i'm sure i've done it loads of times too. hopefully the template will be a gentle nudge in the right direction!
i just can't seem to catch up on this PR backlog
danwalmsley
@danwalmsley
May 03 2018 21:11
@grokys iv made a start on passwordbox, however the template isn't getting applied
code is here:
AvaloniaUI/Avalonia#1544
Iv added StyleKey for it, anything obvious?
Steven Kirk
@grokys
May 03 2018 21:12
danwalmsley
@danwalmsley
May 03 2018 21:14
oh right, literally not a separate control
even better
Steven Kirk
@grokys
May 03 2018 21:14
but to answer your question: you need to add the style to the theme
danwalmsley
@danwalmsley
May 03 2018 21:17
oh yeah
This message was deleted
ahopper
@ahopper
May 03 2018 21:21
@grokys I'm afraid this is the cost of creating something great! I've had a few people using a very early release of an avalonia version of my radio app https://groups.google.com/forum/#!topic/sparksdr/Dzu9oegafII so far all issues have been nothing to do with Avalonia so thank you very much
Steven Kirk
@grokys
May 03 2018 21:22
oh nice!
ahopper
@ahopper
May 03 2018 21:31
I did a bit more profiling on the templated control perf issue, styles are certainly part of it, each check box in a simple app calls approx 900 style match tests
danwalmsley
@danwalmsley
May 03 2018 21:31
@grokys hmm going the winforms route I'm using a textpresenter, when its normal text
and another for password mode
but seems a bit complex,
ok iv realised there is a much easier way
walterlv
@walterlv
May 03 2018 21:35
@danwalmsley Don't agree
danwalmsley
@danwalmsley
May 03 2018 21:36
@walterlv on what?
walterlv
@walterlv
May 03 2018 21:36
Password string must be destroyed as soon as the box is empty
danwalmsley
@danwalmsley
May 03 2018 21:36
@grokys
image.png
walterlv
@walterlv
May 03 2018 21:37
not gc
danwalmsley
@danwalmsley
May 03 2018 21:39
any idea how to ensure its immediately destroyed?
Steven Kirk
@grokys
May 03 2018 21:40
@walterlv are you saying that we should go the PasswordBox/SecureString route?
if an attacker has access to your process' memory you're pretty much screwed anyway surely?
walterlv
@walterlv
May 03 2018 21:43
Only a short period of time while the user is typing password?
yowl
@yowl
May 03 2018 21:44
https://msdn.microsoft.com/en-us/library/system.security.securestring(v=vs.110).aspx has some details, its not fullproof but attempts to help
Steven Kirk
@grokys
May 03 2018 21:45
but if an attacker has access to your process memory, then they can do anything
they can log you out and make you log in again

and as the documentation for SecureString says:

Because Windows doesn't offer a secure string implementation at the operating system level, the .NET Framework still has to convert the secure string value to its plain text representation in order to use it.

danwalmsley
@danwalmsley
May 03 2018 21:46
here is an 'insecure' version anyway with copy and cut disabled
Steven Kirk
@grokys
May 03 2018 21:46
cool
danwalmsley
@danwalmsley
May 03 2018 21:46
seems to work
I'm sure if security really was a concern someone could add a SecurePasswordBox or something
Steven Kirk
@grokys
May 03 2018 21:47
yeah i agree
walterlv
@walterlv
May 03 2018 21:47
You're right
danwalmsley
@danwalmsley
May 03 2018 21:47
and its super nice just setting password char to a value
and its all enabled
that's it
Steven Kirk
@grokys
May 03 2018 21:47
and you have data binding
i always hated PasswordBox because you can't bind
danwalmsley
@danwalmsley
May 03 2018 21:48
yeah id not thought about that when I was going on about securestring, that's a major disadvantage
@grokys when a window is restored, which message tells avalonia to repaint the window?
because my modal window PR child windows don't seem to get that message, or avalonia doesn't process it for some reason
showing the window starts the renderer which will then draw the window on the next render tick
danwalmsley
@danwalmsley
May 03 2018 21:50
ok ill have to see whats happening there
thanks
Steven Kirk
@grokys
May 03 2018 22:01
so happy with the new PR review feature in GitHub for Visual Studio
makes reviewing PRs so much easier!
i mean i did write the feature
so slightly biased
walterlv
@walterlv
May 03 2018 22:11
@danwalmsley My AS still failed to start
Steven Kirk
@grokys
May 03 2018 22:31
@walterlv your new grid definitely seems to be a lot faster than the implementation we currently have!
there are some places where controls are layed out differently however, i've added some comments to the PR
walterlv
@walterlv
May 03 2018 22:32
Excellent! Thanks for your reviewing and testing.
Steven Kirk
@grokys
May 03 2018 22:32
yeah sorry it took so long
walterlv
@walterlv
May 03 2018 22:32
I'm testing, too.
Steven Kirk
@grokys
May 03 2018 22:33
i was wondering - your performance test checks creating a lot of grids but they don't have many children
we were seeing the old grid being really slow with e.g. 3 columns and 300 rows
(like showing all the properties of a control in Devtools)
do you still have the perf test code you used handy?
if so could you try creating a 3x300 grid with a TextBlock in each column?
walterlv
@walterlv
May 03 2018 22:35
OK, I can have a try.
But!!!!!!!
The better implementation is to use virtualization in such a situation.
Steven Kirk
@grokys
May 03 2018 22:36
yeah i know ;)
walterlv
@walterlv
May 03 2018 22:36
I'll improve it's performance as well as I can.
Steven Kirk
@grokys
May 03 2018 22:36
but we don't currently have a solution for virtualizing a table
i'd mostly be interested to see the results
walterlv
@walterlv
May 03 2018 22:38
@danwalmsley told me that the Calendar is not laied out correctly, maybe I lost some testing case in my unit test code.
@grokys Why do you think the new Grid is faster? Is it timed test? They are similar in my own performance test code.
Steven Kirk
@grokys
May 03 2018 22:45
in AvaloniaUI/Avalonia#543 (haha - i didn't fill in the description so now i have to remember what i did :disappointed: ) i had to replace Grid with SimpleGrid control because using Grid in devtools was just too slow
i just tried using Grid again on your branch and it doesn't seem to be slow
so, a very unscientific test
which is why i was wondering if you had benchmarks for large grids
walterlv
@walterlv
May 03 2018 22:47
image.png
walterlv
@walterlv
May 03 2018 22:52
What a stupid me! 😂 I thought the 2-index row is not out of range of 2 rows.
walterlv
@walterlv
May 03 2018 22:55
image.png
😀
Steven Kirk
@grokys
May 03 2018 22:55
exactly ;)
walterlv
@walterlv
May 03 2018 22:59
I lost some unit tests for out of range Grid usage, and I'll add them.
walterlv
@walterlv
May 03 2018 23:09
Twitter stores user's password as plain text to service logs.
walterlv
@walterlv
May 03 2018 23:53
Where can I find the Avalonia Control Gallery?
Found