ButchersBoy / Dragablz

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

Button in TabItem header #267

Open cjmurph opened 2 years ago

cjmurph commented 2 years ago

I'm using dragablz with material design, I want to have a toggle button in the header of a tab item, however because the tab item gets wrapped in a DragablzItem the click is handled before the my button gets it. any ideas? Here's a snippet of the sort of thing I'm doing:

<dragablz:TabablzControl BorderThickness="0" IsManipulationEnabled="False" Margin="5" Grid.Row="1" Grid.ColumnSpan="6">
  <TabItem>
    <TabItem.Header>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <TextBlock Text="SOME HEADER" FontWeight="Medium" Foreground="{DynamicResource PrimaryHueMidForegroundBrush}"/>
        <ToggleButton Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" IsChecked="{Binding SomeBooleanOnMyViewModel}" VerticalAlignment="Center" Margin="8,4,0,4"
                              Style="{StaticResource MaterialDesignSwitchToggleButton}"/>
        </Grid>
      </TabItem.Header>
    <Grid>
    </Grid>
  </TabItem>
</dragablz:TabablzControl>