Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Why additional Canvas prevents the button click filing? RSS

12 replies

Last post Nov 08, 2010 04:41 AM by Shi Ding - MSFT

(0)
  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Why additional Canvas prevents the button click filing?

    Oct 31, 2010 03:46 AM | LINK

    I have the following xaml code.  The button click filed without the second <Canvas></Canvas> block.  As soon as I added the second <Canvas></Canvas> block, it stopped filing.  Why?  How do I resolve it?  Thanks.

    <Grid x:Name="LayoutRoot">
            <Canvas>
    
                <!-- Layer 1/<Group>/<Path> -->
                <Path Fill="#ffffffff" Data="F1 M 374.110,416.974 C 368.478,416.974 363.910,421.541 363.910,427.174 L 363.910,440.774 C 363.910,446.407 368.478,450.974 374.110,450.974 L 591.710,450.974 L 591.710,416.974 L 374.110,416.974 Z"/>
    
                <!-- Layer 1/<Group>/<Path> -->
                <Path Data="F1 M 660.640,416.974 L 591.710,416.974 L 591.710,450.974 L 660.640,450.974 C 666.273,450.974 670.840,446.407 670.840,440.774 L 670.840,427.174 C 670.840,421.541 666.273,416.974 660.640,416.974 Z">
                    <Path.Fill>
                        <LinearGradientBrush MappingMode="Absolute" StartPoint="417.900,318.977" EndPoint="417.900,288.329">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop Offset="0.00" Color="#fff09024"/>
                                <GradientStop Offset="1.00" Color="#fff15b26"/>
                            </LinearGradientBrush.GradientStops>
                            <LinearGradientBrush.Transform>
                                <MatrixTransform Matrix="1.000,0.000,-0.000,-1.000,213.375,738.500" />
                            </LinearGradientBrush.Transform>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
    
                <!-- Layer 1/<Group>/sign up for our newsletter -->
                <TextBlock Foreground="#ff083950" Canvas.Left="372.910" Canvas.Top="424.470" FontSize="15.00" FontFamily="Myriad Pro">sign up for our newsletter</TextBlock>
    
                <!-- Layer 1/<Group>/SUBMIT -->
                <Button Canvas.Left="599.910" Canvas.Top="424.470" FontSize="15" FontFamily="Verdana" BorderThickness="0" FontWeight="Bold" Foreground="#FFFFFF" ClickMode="Release"  Click="Button_Click" Content="Submit">
                    <Button.Template>
                        <ControlTemplate TargetType="Button">
                            <Border x:Name="Border" Background="#FFF09024" BorderThickness="0">
                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </Border>
                        </ControlTemplate>
                    </Button.Template>
                </Button>
    
            </Canvas>
            <Canvas>
                <!-- Layer 1/<Group>/<Group>/<Path> -->
                <Path Opacity="0.1" Data="F1 M 1040.125,683.637 L 2.408,683.637 L 2.375,4.000 L 1040.125,4.000 L 1040.125,683.637 Z">
                    <Path.Fill>
                        <LinearGradientBrush MappingMode="Absolute" StartPoint="5830.711,-10645.320" EndPoint="5060.248,-10645.320">
                            <LinearGradientBrush.GradientStops>
                                <GradientStop Offset="0.00" Color="#ff9dd9e1"/>
                                <GradientStop Offset="0.32" Color="#ff58a0b3"/>
                                <GradientStop Offset="1.00" Color="#ff136786"/>
                            </LinearGradientBrush.GradientStops>
                            <LinearGradientBrush.Transform>
                                <MatrixTransform Matrix="-1.000,0.000,0.000,1.000,6100.375,10989.137" />
                            </LinearGradientBrush.Transform>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
    
            </Canvas>
        </Grid>


     

  • neal.gabriel

    neal.gabriel

    Contributor

    4520 Points

    789 Posts

    Re: Why additional Canvas prevents the button click filing?

    Oct 31, 2010 05:02 AM | LINK

    The second canvas comes on top of the fist canvas where the button control is placed; One method is to place the second canvas before the first canvas;

     

    Regards...

    Neal Gabriel
    Follow me on twitter
    My Blog
  • thaicarrot

    thaicarrot

    All-Star

    16589 Points

    4351 Posts

    Re: Why additional Canvas prevents the button click filing?

    Oct 31, 2010 05:03 AM | LINK

     

    Best Regards
    Weera

  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: Why additional Canvas prevents the button click filing?

    Oct 31, 2010 05:47 AM | LINK

    You are right.  I moved the second canvas to the top and the button, but the image disapeared.  The xmal file was exported from a Adobe Illustrator file.  There are hundreds canvases.  I have to keep them in place to have the design for the page.  What can I do?

  • neal.gabriel

    neal.gabriel

    Contributor

    4520 Points

    789 Posts

    Re: Re: Re: Why additional Canvas prevents the button click filing?

    Oct 31, 2010 05:57 AM | LINK

    I dont think you need the second canvas; I dont see any use;

    What is the objective?

    Do you need to create a form similar to that in Illustrator?

    Why do you need canvas object? Is three any animation?

    Regards...

    Neal Gabriel
    Follow me on twitter
    My Blog
  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: Re: Re: Why additional Canvas prevents the button click filing?

    Oct 31, 2010 06:44 PM | LINK

    It was designed in Illustator by a web designer. It is very complex that I don't want to change the design.  The xaml is very long with very detail design.  My job is to make the controls work, like  the button, textbox, link, etc.

  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: Re: Re: Re: Why additional Canvas prevents the button click filing?

    Oct 31, 2010 10:57 PM | LINK

    I resolved it by moving the Canvas with the button to the bottom of all canvases.  I would like to know why if anyone would like to share.

  • neal.gabriel

    neal.gabriel

    Contributor

    4520 Points

    789 Posts

    Re: Re: Re: Re: Re: Re: Why additional Canvas prevents the button click filing?

    Nov 01, 2010 02:40 AM | LINK

    What?Undecided

    Regards...

    Neal Gabriel
    Follow me on twitter
    My Blog
  • Shi Ding - MSFT

    Shi Ding - MSFT

    All-Star

    24707 Points

    3151 Posts

    Microsoft

    Re: Re: Re: Re: Re: Why additional Canvas prevents the button click filing?

    Nov 05, 2010 08:52 AM | LINK

    Hi,

    I think it's because the lastest added emlement is placed in the toppest layer.

    Before you move it to the end, the toppest layer is that light blue path and all click is on that path not the button.

     

    Best Regards,

    Shi Ding
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com
    Microsoft One Code Framework
  • danyeung

    danyeung

    Member

    39 Points

    112 Posts

    Re: Re: Re: Re: Re: Why additional Canvas prevents the button click filing?

    Nov 05, 2010 11:26 PM | LINK

    How can I fix it?  Thanks.