Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PLEASE help me!! I'm using WPF Browser Application to do an app. I have my main Page and a user control.

The name of my user control is book.xaml. In it I have this....

XML
<Grid>
        <Image Height="154" HorizontalAlignment="Left" Margin="25,58,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="263" Source="/LoadImage;component/Resources/book.png" />

        <Grid Name="BookGrid" Height="154" Width="263" Margin="24,58,12,88">
            <TextBlock Height="40" HorizontalAlignment="Left" Margin="10,28,0,0" Name="textBlock1" Text="word" VerticalAlignment="Top" FontSize="36" />
            <TextBlock Height="38" HorizontalAlignment="Left" Margin="10,54,0,0" Name="textBlock2" Text="word" VerticalAlignment="Top" FontSize="32" />
            <TextBlock Height="30" HorizontalAlignment="Left" Margin="15,79,0,0" Name="textBlock3" Text="word" VerticalAlignment="Top" FontSize="28" />
            <TextBlock Height="31" HorizontalAlignment="Left" Margin="16,102,0,0" Name="textBlock4" Text="word" VerticalAlignment="Top" FontSize="26" />
            <TextBlock Height="30" HorizontalAlignment="Left" Margin="99,43,0,0" Name="textBlock5" Text="word" VerticalAlignment="Top" FontSize="24" Width="54" />
            <TextBlock Height="28" HorizontalAlignment="Left" Margin="99,79,0,0" Name="textBlock6" Text="word" VerticalAlignment="Top" FontSize="22" />
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="103,102,0,0" Name="textBlock7" Text="word" VerticalAlignment="Top" FontSize="20" />
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="133,35,0,0" Name="textBlock8" Text="word" VerticalAlignment="Top" FontSize="18" />
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="122,69,0,0" Name="textBlock9" Text="word" VerticalAlignment="Top" FontSize="16" />
            <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,94,0,0" Name="textBlock10" Text="word" VerticalAlignment="Top" FontSize="14" />
        </Grid>

    </Grid>



In my main Page, I have this....

XML
<Grid>
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="88,234,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        <Grid Height="154" HorizontalAlignment="Left" Margin="25,37,0,0" Name="grid1" VerticalAlignment="Top" Width="263" />
    </Grid>


My question is, how do I display the grid that has textblocks from my user control to the grid on my main Page when the button is pressed? I know that all the codes should be done on my main Page. I was told to do a function that takes in the grid and does the loading of textblocks. Then, when the button is pressed call the function and pass in the correct grid. I've been trying to do that but no success so far.

I know that I have to use this code to call the grid from the user control,
grid.Name.Children.Add(); I also know that the grid in that code refers to the grid from the user control and the name in the () is the name of the user control. But how do I use that? Please Please somebody help me!!!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900