I rolled my own "splitbutton" that consists of a button, expander and popup with 1-N more buttons. Now the buttons in popup come very thick border around them eventhough button's style has BorderThickness="0". So the border is probably set because buttons are in popup. My question is: How to override border so that all other Button style "properties" are not overridden?
<Popup
IsOpen="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:SplitButton}}, Path=IsExpanded}"
PlacementTarget="{Binding ElementName=Button}"
PopupAnimation="Fade"
StaysOpen="False"
>
<Popup.Resources>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="0" />
</Style>
</Popup.Resources>
<ItemsControl ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type my:SplitButton}}, Path=ItemsSource}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Converter={ui:ConvertObjectToResource}}" Tag="{Binding}" Click="Control_Click" BorderThickness="0"
Width="{Binding ActualWidth, ElementName=WidthButton}">
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Popup>
EDIT: I can actually do like this:
<Popup.Resources>
<Style TargetType="Button">
<Setter Property="BorderThickness" Value="0" />
</Style>
</Popup.Resources>
This unfortunately overrides button's all other style properties (like padding and background, foreground).
I can also do like this:
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Converter={ui:ConvertObjectToResource}}" Tag="{Binding}" Click="Control_Click"
Width="{Binding ActualWidth, ElementName=WidthButton}">
<Button.Style>
<Style TargetType="Button">
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
</Style>
</Button.Style>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
but also that overrides button's style. If I try to tackle that by setting BasedOn="ButtonsNormalStyleHere" the borders come back again, i.e. BorderThickness and BorderBrush have no effect.