私のフォームには aTextBox
と aがあります。Button
テキストを入力し、マウスをダブルクリックすると、Button
Command,CommandParameter が呼び出されます。これは可能ですか?
コードビハインドはありません。
私のフォームには aTextBox
と aがあります。Button
テキストを入力し、マウスをダブルクリックすると、Button
Command,CommandParameter が呼び出されます。これは可能ですか?
コードビハインドはありません。
内部に TextBox を持つボタン テンプレートを作成できます (おそらく、IsHitTestVisible を false に設定し、外側のグリッドを透明な背景に設定します)。次に、コマンドをこの「TextBox-Button」に直接バインドできます。
編集:ソースコード:
<Grid>
<Grid.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<TextBox />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Button Content="Test" />
</Grid>
そして、 hereおよびhere で説明されているように、Attached Behavior Pattern を介してコマンドを呼び出します。
アンドレイ