1
내 버튼이 주위에 클릭 할 수없는 클릭 가능 영역을 갖도록 버튼 템플릿을 만들고 싶습니다. 나는 지역을 누를 때 버튼이 이벤트가 여기보이지 않는 클릭 가능 영역이있는 wpf 만들기 버튼 템플릿
내 시도입니다해야 클릭
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="214,150,0,0" Name="button1" VerticalAlignment="Top" Click="button1_Click">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="Pink" Padding="25">
<Button Content="{TemplateBinding Content}"></Button>
</Border>
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</Window>
내가 경계 내부 누를 때 button1_Click
메소드가 불려가. 하지만 내부 버튼 애니메이션은 활성화되지 않습니다.
테두리 영역 안쪽을 누를 때 클릭 한 것처럼 내부 버튼을 클릭하고 싶습니다.
왜 버튼에 다른 버튼이 포함되어 있습니까? – dowhilefor
@dowhilefor 보이지 않는 클릭 가능한 마진이있는 버튼을 만들 수있는 다른 방법을 사용해도 좋습니다. – Nahum
그건 정상입니다. 내부 버튼은 '클릭 이벤트'를받지 않기 때문에 외부 버튼이 수행합니다. 또한 외부 버튼 인'ControlTemplate'에는 클릭 애니메이션이 없으므로 보이지 않습니다. – DHN