locked
XAML to C# RRS feed

  • Question

  • Hello,
    I need help I am converting XAML to C# I am able to convert it but I am having trouble accessing "dborder"/"r2"/"piece" in the rest of my code and putting r2/piece inside the border. I create the objects in one function and then use the objects in another for hit detection but the hit detection function inst picking up r2.

    <Border x:Name="dborder" TouchUp="dborder_TouchUp" Width="240" Height="280" Visibility="Hidden">
        <Grid>
            <Rectangle x:Name="r2" Canvas.Left="137" Canvas.Top="29" Fill="AntiqueWhite" Margin="25.683,31.517,0,0" HorizontalAlignment="Left" Width="10" Height="8" VerticalAlignment="Top" />
            <Image x:Name="piece" ClipToBounds="True" Stretch="Fill" Width="866" Height="577" Margin="6.5,18.343,-632.5,-315.343">
                <Image.Clip>
                    <PathGeometry Figures="M219,118c-2-4-6,2-7,4c-16,20-48,26-59,2c-5-12-6-33,8-40c17-8,35,0,53-4  c2,0,2-5,2-8c-2-18-9-36-3-54c1.802-5.585,3.835-11.301,6.139-17H1v191.627c24.424,0.854,48.995-1.917,74,1.373c11,1,25,16,12,24  c-11,7-21,14-28,26c-4,6,0,16,8,18c31,11,73,19,95-5c16-18-5-40-16-59c-4-6,9-8,14-8c17.849-2.45,35.574-3.549,53.221-3.819  c1.521-6.976,3.353-13.903,4.779-20.181C221,150,225,134,219,118z"/>
                </Image.Clip>
            </Image>
        </Grid>
    </Border>

    Thanks,
    B
    ------------------------------------ tq
    Friday, June 18, 2010 2:11 PM

Answers

  • Make a new field in your class called r2 and in the function where you new up the Rectangle assign it to r2.
    • Marked as answer by Brian Ahearn Friday, June 18, 2010 5:20 PM
    Friday, June 18, 2010 2:47 PM