在Silverlight 3項目中,我在邊框控件上使用鼠標左鍵按下事件,但發現事件即使在單擊邊界外的按鈕(如5-10像素)時也會引發。Silverlight鼠標左按鈕問題
有沒有人遇到過這個問題?
感謝您的期待!
以下是XAML,我們正在捕捉brdSelect的事件:
<Border MouseLeftButtonDown="Grid_Mousedown" x:Name="brdSelect" Grid.Row="1" Grid.Column="1" BorderThickness="0.5" BorderBrush="#FF2D9FD2">
<Grid x:Name="grdSelect" >
<Border x:Name="brdImage" BorderThickness="0" CornerRadius="5" Width="Auto" Height="Auto">
<Image Height="Auto" Width="Auto" Stretch="UniformToFill" x:Name="imgMotive"/>
</Border>
<Image Height="Auto" Stretch="UniformToFill" x:Name="imgtmp" Visibility="Collapsed"/>
</Grid>
</Border>
<Image Height="13" Width="13" Source="../Images/rotate_small.JPG" Stretch="None" x:Name="imgRotate" Grid.Row="0" Grid.Column="3" Visibility="Collapsed"/>
<StackPanel Orientation="Horizontal" d:LayoutOverrides="GridBox" Grid.ColumnSpan="3" Margin="0,0,2,0" Width="32" HorizontalAlignment="Left">
<Image Height="13" Width="13" Source="../Images/delete_small.JPG" Stretch="None" x:Name="imgDelete" Visibility="Collapsed" />
</StackPanel>
<Image Source="../Images/resize_small.JPG" Stretch="None" x:Name="imgResize" Grid.Row="2" Grid.RowSpan="2" Grid.Column="2" Visibility="Collapsed" Opacity="0"/>
</Grid>
<TextBlock x:Name="txtLabel" Height="100" HorizontalAlignment="Left" Margin="-80,0,0,-20" Width="80" Text="X: 0 --- Y: 0" Foreground="Red" TextWrapping="Wrap" Visibility="Collapsed"/>
</Grid>
</Border>
你能展示你的XAML嗎? – 2010-02-16 13:54:01
您確定您沒有應用保證金,或者邊界內的內容是否有負值? – AnthonyWJones 2010-02-16 14:26:05
分享您的XAML可能會有幫助。 – funwithcoding 2010-02-16 14:45:46