RadWidow Passing paramater to user control

4 posts, 0 answers
  1. Emmanuel
    Emmanuel avatar
    18 posts
    Member since:
    Oct 2010

    Posted 05 Dec 2010 Link to this post

    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.
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 08 Dec 2010 Link to this post

    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
  3. DevCraft banner
  4. Emmanuel
    Emmanuel avatar
    18 posts
    Member since:
    Oct 2010

    Posted 08 Dec 2010 Link to this post

    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.
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 13 Dec 2010 Link to this post

    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
Back to Top