This is a migrated thread and some comments may be shown as answers.

RadWidow Passing paramater to user control

3 Answers 45 Views
Window
This is a migrated thread and some comments may be shown as answers.
Emmanuel
Top achievements
Rank 1
Emmanuel asked on 06 Dec 2010, 05:50 AM
I'd like to show a RadWindow with his content as an silverlight user control.Let's say in the user control there is a textbox, and It will show Hello + the name parameter passed. Any help would be greatly appreciated.

3 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 08 Dec 2010, 10:38 AM
Hi Emmanuel,

Thank you for contacting us.

There are several ways for achieving this. You can use the Tag property of the UI elements. Or you could also use a DataContext and bind the controls. Another way of achieving your goal is to expose the controls, to which you are going to assign values, and set them directly.
Hope this information helps.

If you need further assistance please let us know.


Regards,
Konstantina
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Emmanuel
Top achievements
Rank 1
answered on 08 Dec 2010, 04:39 PM
Thank you Constantina,
i am really new to Sileverlight, and your help was really appreciated, and I will read more for my next development, but could you please show me a practical way to apply tag property, in this sample. let's say i have the following  usercontrol :

<UserControl x:Class="TVPage.SilverlightControl1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBox Name="myTxt" Margin="125,107,115,147" />
    </Grid>
</UserControl>

How can I add a tag to it, and show this UC in a Radwindow by selecting the content of myTxt from the page declaring my radwindow. thanks again , and looking forward to reading from you.
0
Konstantina
Telerik team
answered on 13 Dec 2010, 11:57 AM
Hi Emmanuel,

Thank you for the details.

Once you have created your UserControl, you can easily set it as a Content of the RadWindow in the MainPage as follows:
MyUC uc = new MyUC();
RadWindow myWin = new RadWindow();
myWin.Content = uc;

Then, you can add the TextBox to the Content of the UserControl and set its Text property:
TextBox text = new TextBox();
text.Text = "My Text from the main page";
uc.Content = text;

And finally, show the RadWindow:

myWin.Show();

Hope this information helps. If you have further questions please let us know.

Regards,
Konstantina
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Window
Asked by
Emmanuel
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Emmanuel
Top achievements
Rank 1
Share this question
or