![](/img/trans.png)
[英]WPF. Is it possible to create DataGridTemplateColumn.CellTemplate with ComboBox and TextBox?
[英]WPF. Is it possible to do ellipse “rectangle bounds” hittest?
您可以將它們都放入
邊框
網格並檢查它是否被單擊
XAML:
<Grid MouseDown="Border_MouseDown">
<Rectangle Width="100"
Height="100"
Fill="Green" />
<Ellipse Width="100"
Height="100"
Fill="Orange" />
</Grid>
代碼背后
private void Border_MouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("hit it");
}
編輯只是為了完成這里只有綠色區域的XAML:
<Grid>
<Rectangle Width="100"
Height="100"
Fill="Green"
MouseDown="Border_MouseDown" />
<Ellipse Width="100"
Height="100"
Fill="Orange" />
</Grid>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.