回答編集履歴

1

tuiki

2015/11/27 04:37

投稿

Tak1wa
Tak1wa

スコア4791

test CHANGED
@@ -53,3 +53,29 @@
53
53
  ボタンの中はxxxContentAlignmentで調整できます。(上の例では左上に寄せました)
54
54
 
55
55
  ListBoxItemのボーダーサイズなどを調整してボタン同士をくっつけてみました。これについては他に最適解があるかも。
56
+
57
+
58
+
59
+ ---
60
+
61
+
62
+
63
+ ```XML
64
+
65
+ <ControlTemplate TargetType="{x:Type Button}">
66
+
67
+ <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
68
+
69
+ <!--<StackPanel Orientation="Horizontal">-->
70
+
71
+ <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
72
+
73
+ <!--</StackPanel>-->
74
+
75
+ </Border>
76
+
77
+ ```
78
+
79
+
80
+
81
+ ButtonListStyleがStackPanelで詰められているからですね。