These are chat archives for AvaloniaUI/Avalonia

29th
Dec 2018
Valters
@FaithLV
Dec 29 2018 10:51 UTC
Hey, I'm having problems setting horizontal content alignment for ContentControl. Any ideas?
    <Grid>
    <StackPanel Orientation="Vertical">

        <Grid>
            <Rectangle Name="Titlebar" Height="50"/>
            <StackPanel Name="TitlebarPanel" Orientation="Horizontal" VerticalAlignment="Center" Margin="15,0,15,0"/>
        </Grid>

        <ContentControl Name="ContentContainer" HorizontalContentAlignment="Center" Background="Black"/>

    </StackPanel>
</Grid>
ContentContainer holds a WrapPanel control, tried setting it down through the line, nothing seems to change.
Steven Kirk
@grokys
Dec 29 2018 10:54 UTC
is the ContentContainer being stretched the the width of the StackPanel?
Valters
@FaithLV
Dec 29 2018 10:56 UTC
yeah
Tested by making background black
It's seems that WrapPanel must be causing this, because it's being stretched too.
It goes beyond children
Steven Kirk
@grokys
Dec 29 2018 11:02 UTC
beyond children?
try using a DockPanel or Grid instead of StackPanel
Valters
@FaithLV
Dec 29 2018 11:25 UTC
I mean, the ContentControl has a WrapPanel as content and that has it's own issues, same thing I had in WPF, i'll figure it out later, not that important.
The issue is that width of WrapPanel doesn't scale to content.
ahopper
@ahopper
Dec 29 2018 13:51 UTC
Animation FillMode="Forward" appears broken again, I guess by #2163 . The animation frequently stops short of the end value, unless there is something else I now have to set.
Jonas Jermann
@jjermann
Dec 29 2018 15:29 UTC

hi, I defined the following datatemplate:

        <DataTemplate DataType = "{x:Type vm:CardRepresentation}">
            <Border BorderBrush = "Black"
                    BorderThickness = "{Binding BorderThickness}"
                    CornerRadius = "3"
                    Width = "100"
                    Height = "150">
                <Image Source = "{Binding ImageSource, Converter={StaticResource StringToBitmapConverter}}"
                       Stretch = "Uniform" />
            </Border>
        </DataTemplate>

With BorderThickness beeing a public double property.
But somehow it won't work (no border is shown).
It works if I manually put a value in the xaml for BorderThickness.

As a side note I would be really interested how I can put my templates in a separate file (Resource dictionary) and reference them in this file.

ahopper
@ahopper
Dec 29 2018 15:36 UTC
@jjermann in code you probably have to use a Thickness struct to bind to, the xaml does magic to make things simple
Jonas Jermann
@jjermann
Dec 29 2018 15:38 UTC
but the documentation says double
Ok, so I'll do a DoubleToThicknessConverter
Jumar Macato
@jmacato
Dec 29 2018 15:44 UTC
thought those were being regen'd recently
Jonas Jermann
@jjermann
Dec 29 2018 15:49 UTC
is there a documentation on how to do resource dictionaries for e.g. datatemplates?
Oh I just realized: It looks like Avalonia already has builtin Converters, can I use those instead of creating my own?
For instance: string->Bitmap or string<->brush or double<->thickness
Jeffrey Ye
@jeffreye
Dec 29 2018 17:23 UTC
image.png
A black border appear when I start it on Windows
Resizing window will fix it.
does anyone know how to fix it in code?
ahopper
@ahopper
Dec 29 2018 17:25 UTC
don't know how to fix but AvaloniaUI/Avalonia#2166
Jeffrey Ye
@jeffreye
Dec 29 2018 17:34 UTC
thanks
Nikita Tsukanov
@kekekeks
Dec 29 2018 18:18 UTC
I'll try to fix it inJanuary
Jonas Jermann
@jjermann
Dec 29 2018 21:01 UTC
Hmm, how does Visibility of controls work in Avalonia? I only found a boolean IsVisible. How do I set the Visibility to collapsed?
jp2masa
@jp2masa
Dec 29 2018 21:02 UTC
I think IsVisible set to false is equivalent to collapsed
to hide, but not collapse, I think you can set opacity to 0
Jonas Jermann
@jjermann
Dec 29 2018 21:02 UTC
ah!
nice that makes sense
thanks
no more visibility converters :)