ButchersBoy / Dragablz

Dragable and tearable tab control for WPF
http://dragablz.net
MIT License
2.22k stars 328 forks source link

Styling DragablzItemsControl using UniformGrid #240

Open codingdna2 opened 4 years ago

codingdna2 commented 4 years ago

Hi, first of all thanks for the outstanding project! I really hope the author will be back soon (all hail the captain), meanwhile I hope community could give me a hint about my issue..

I've made a custom style for TabablzControl using an ItemsPanel Template with a UniformGrid (the idea is to shrink tabs when tabs area gets full and to avoid scrollbars).

<Style x:Key="UniformGridItemsControlStyle" TargetType="{x:Type dragablz:DragablzItemsControl}">
    <Setter Property="HorizontalAlignment" Value="Left" />
    <Setter Property="VerticalAlignment" Value="Top" />
    <Setter Property="ItemsPanel">
        <Setter.Value>
            <ItemsPanelTemplate>
                <UniformGrid IsItemsHost="True" Rows="1" />
            </ItemsPanelTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type dragablz:DragablzItemsControl}">
                <ItemsPresenter Width="{TemplateBinding ActualWidth}"
                                Height="{TemplateBinding ItemsPresenterHeight}"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Top"
                                SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Issue is that when I do this, the drag preview of tabs (reordering) stops working (while the tear-off feature keeps working).

Any suggestions is highly appreciated. Kind Regards

EDIT: Attached sample UniformGridIssue.zip