Odeslat dotazOdeslat dotaz
 

OdpovědětBubbling and Tunneling Events

  • 21. června 2006 19:53Tomer Shamam Uživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaileUživatelské medaile
     

    Hi,

    I'm running the following XAML:

    <Window x:Class="Controls.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Controls" Height="300" Width="300"

    >

    <WrapPanel>

    <Button x:Name="button"

    PreviewMouseLeftButtonDown="PreviewA"

    MouseLeftButtonDown="A">

    <Grid

    PreviewMouseLeftButtonDown="PreviewB"

    MouseLeftButtonDown="B">

    <WrapPanel>

    <Ellipse Fill="Blue" Margin="5" Width="25" Height="25" Stroke="Black" HorizontalAlignment="Center" VerticalAlignment="Center"

    PreviewMouseLeftButtonDown="PreviewC"

    MouseLeftButtonDown="C"

    />

    <TextBlock Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Text="Click Me!"

    PreviewMouseLeftButtonDown="PreviewD"

    MouseLeftButtonDown="D"

    />

    </WrapPanel>

    </Grid>

    </Button>

    </WrapPanel>

    </Window>

    Each event handler writes  its name using Debug.WriteLine().

    The problem is that the Bubble event does not implemented by the Button. How's that?

    The output is:

    PreviewA

    PreviewB

    PreviewC

    C

    B

    Where is 'A' ???

    Is it possible that Button already implements MouseLeftButtonDown to create the "Click" event instead? I think that it is a BUG!

    Tomer

Odpovědi

Všechny reakce