These are chat archives for AvaloniaUI/Avalonia

22nd
Aug 2018
Jumar Macato
@jmacato
Aug 22 2018 06:20
@siegfriedpammer I've only seen the previous iteration of your PR but i'll have that PR re-examined later
Siegfried Pammer
@siegfriedpammer
Aug 22 2018 06:24
Thank you. In the mean time I will think about other ways of doing it differently, but the feature is so simple, so this is the only sensible approach I can think of.
Jumar Macato
@jmacato
Aug 22 2018 06:24
Please do! :)
Siegfried Pammer
@siegfriedpammer
Aug 22 2018 06:25
All other ideas involve either creating useless copies in memory or not using WeakReference...
Jumar Macato
@jmacato
Aug 22 2018 06:35
we'd need it to be structurally distinct from the tainted source & as efficient as it can be.. it can be difficult but it has been done before (with AvaloniaUI/Avalonia#1517 as an example).
Nicolas Musset
@Kryptos-FR
Aug 22 2018 06:48
@jmacato I just went through that #1517 PR and that was amazing community work. Great example.
I wish we could "pin" or "fave" some PR as example. Might suggest that feature to GitHub...
Jumar Macato
@jmacato
Aug 22 2018 06:51
Yeah man it was awesome! There was a PR that was ripped out off RefSource AvaloniaUI/Avalonia#469 and it was problematic for the same reason as we have now
Siegfried Pammer
@siegfriedpammer
Aug 22 2018 14:48
does Avalonia's text rendering already support "text decorations" like underline?
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 15:04
I think that's currently in PR.
Siegfried Pammer
@siegfriedpammer
Aug 22 2018 15:04
OK
just came across this while porting support for FontWeight and FontStyle from AvalonEdit to AvaloniaEdit
it's not super important because most highlightings don't use underlining anyway...
Benedikt Schroeder
@Gillibald
Aug 22 2018 15:17

I have this style with initial value set to TabStripPlacement="Top":

<Style Selector="TabControl[TabStripPlacement=Bottom] /template/ #PART_TapStrip">
        <Setter Property="DockPanel.Dock" Value="Bottom"/>
</Style>

And if I change TabStripPlacement by binding to Bottom the style doesn't get applied.
This is the property definition:

public static readonly StyledProperty<Dock> TabStripPlacementProperty =
            AvaloniaProperty.Register<TabControl, Dock>(nameof(TabStripPlacement), defaultValue: Dock.Top);

Any idea why this doesn't work?

Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 15:27
@Gillibald what's the style with the initial value? You might need to move the Setter for TabStripPlacement=Top into a separate style with a selector like the one you posted.
Benedikt Schroeder
@Gillibald
Aug 22 2018 15:35
<Styles xmlns="https://github.com/avaloniaui"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style Selector="TabControl">
        <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
        <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <ControlTemplate>
                <Border
                    Margin="{TemplateBinding Margin}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                    VerticalAlignment="{TemplateBinding VerticalAlignment}">
                    <ScrollViewer
                        Name="PART_ScrollViewer"
                        HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
                        VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
                        <DockPanel>
                            <ItemsPresenter
                                Name="PART_ItemsPresenter"
                                DockPanel.Dock="Top"
                                Items="{TemplateBinding Items}"
                                ItemsPanel="{TemplateBinding ItemsPanel}"
                                ItemTemplate="{TemplateBinding ItemTemplate}"
                                MemberSelector="{TemplateBinding MemberSelector}"                     >
                            </ItemsPresenter>
                            <ContentPresenter
                                Name="PART_Content"
                                Margin="{TemplateBinding Padding}"
                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                Content="{TemplateBinding SelectedContent}"
                                ContentTemplate="{TemplateBinding SelectedContentTemplate}">
                            </ContentPresenter>
                        </DockPanel>
                    </ScrollViewer>
                </Border>
            </ControlTemplate>
        </Setter>
    </Style>
So you think i just Need an extra selector for TabStripPlacement=Top?
Like so:
<Style Selector="TabControl[TabStripPlacement=Top] /template/ #PART_TapStrip">
        <Setter Property="DockPanel.Dock" Value="Top"/>
</Style>
Benedikt Schroeder
@Gillibald
Aug 22 2018 15:43
It just doesn't work if TabStripPlacement is changed by a binding
Benedikt Schroeder
@Gillibald
Aug 22 2018 16:03
It seems I had the naming wrong #PART_TapStrip instead of #PART_ItemsPresenter but still it doesn't update
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 16:21
Don't set DockPanel.Dock in the default TabControl style. That's what isn't working. The value set there gets LocalValue priority, which beats out the StyleTrigger priority of the other styles.
We really need to figure out how to fix that...
Benedikt Schroeder
@Gillibald
Aug 22 2018 16:39
<Style Selector="TabControl">
        <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
        <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/>
        <Setter Property="Padding" Value="4"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Template">
            <ControlTemplate>
                <Border
                    Margin="{TemplateBinding Margin}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                    VerticalAlignment="{TemplateBinding VerticalAlignment}">
                    <ScrollViewer
                        Name="PART_ScrollViewer"
                        HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
                        VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
                        <DockPanel>
                            <ItemsPresenter
                                Name="PART_ItemsPresenter"
                                Items="{TemplateBinding Items}"
                                ItemsPanel="{TemplateBinding ItemsPanel}"
                                ItemTemplate="{TemplateBinding ItemTemplate}"
                                MemberSelector="{TemplateBinding MemberSelector}"                     >
                            </ItemsPresenter>
                            <ContentPresenter
                                Name="PART_Content"
                                Margin="{TemplateBinding Padding}"
                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                Content="{TemplateBinding SelectedContent}"
                                ContentTemplate="{TemplateBinding SelectedContentTemplate}">
                            </ContentPresenter>
                        </DockPanel>
                    </ScrollViewer>
                </Border>
            </ControlTemplate>
        </Setter>
    </Style>
    <Style Selector="TabControl[TabStripPlacement=Top] /template/ #PART_ItemsPresenter">
        <Setter Property="DockPanel.Dock" Value="Top"/>
    </Style>
    <Style Selector="TabControl[TabStripPlacement=Bottom] /template/ #PART_ItemsPresenter">
        <Setter Property="DockPanel.Dock" Value="Bottom"/>
    </Style>
    <Style Selector="TabControl[TabStripPlacement=Left] /template/ #PART_ItemsPresenter">
        <Setter Property="DockPanel.Dock" Value="Left"/>
    </Style>
    <Style Selector="TabControl[TabStripPlacement=Left]">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style Selector="TabControl[TabStripPlacement=Right] /template/ #PART_ItemsPresenter">
        <Setter Property="DockPanel.Dock" Value="Right"/>
    </Style>
    <Style Selector="TabControl[TabStripPlacement=Right]">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Vertical"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
This still doesn't work. The binding updates the property on TabControl but the style isn't applied on change.
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 16:56
Hmm. That might be a bug with the property value selector.
Benedikt Schroeder
@Gillibald
Aug 22 2018 17:36
Is there a SharpDX gitter?
I tried to build against the current CI nuget packages and it seems code generation is broken. Just wanted to try if recent changes fixed ColorGlyphRun.
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 18:05
Did you try the most recent NuGet package? I thought I got all the code-gen bugs fixed...
The pre-release?
Benedikt Schroeder
@Gillibald
Aug 22 2018 18:43
The CI builds from nuget
Version 4.2.0-ci284 and some later builds.
All had missing implementation of DirectWrite.ColorGlyphRun marshalling
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 18:54
Hmm I'll take a look when I have time. Can you open an issue?
Benedikt Schroeder
@Gillibald
Aug 22 2018 18:55
Y sure will create an issue tomorrow
Jeremy Koritzinsky
@jkoritzinsky
Aug 22 2018 18:59
👍