TextBox in MessageBox

5 posts, 0 answers
  1. Gianluc
    Gianluc avatar
    5 posts
    Member since:
    Nov 2013

    Posted 02 Jan 2014 Link to this post

    Hi, how can I get the text entered in the textbox in a variable of type string in c# ?
    <ControlTemplate x:Key="searchTemplate" TargetType="teleSpec:RadMessageBoxControl">
                <Border Padding="12" Background="{StaticResource PhoneChromeBrush}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <ContentControl x:Name="PART_Title" HorizontalContentAlignment="Left" FontSize="{StaticResource PhoneFontSizeLarge}" FontFamily="{StaticResource PhoneFontFamilySemiBold}" Margin="{StaticResource PhoneMargin}" />
                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                            <Image Source="SomeImage.png" Margin="12, 12, 0, 24" />
                            <telerikPrimitives:RadTextBox Watermark="Text here"  x:Name="txtSearch" Margin="5,6,0,11" Width="427" />
                            <ContentControl HorizontalContentAlignment="Left" VerticalContentAlignment="Top" x:Name="PART_Message" Margin="12, 12, 12, 24"  />
                        </StackPanel>
                        <CheckBox x:Name="PART_CheckBox" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                        <ContentControl Grid.Row="3" x:Name="PART_ButtonsContainer" HorizontalContentAlignment="Stretch">
                            <ContentControl.ContentTemplate>
                                <DataTemplate>
                                    <StackPanel x:Name="PART_ButtonsPanel" Orientation="Horizontal"></StackPanel>
                                </DataTemplate>
                            </ContentControl.ContentTemplate>
                        </ContentControl>
                    </Grid>
                </Border>
            </ControlTemplate>
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 02 Jan 2014 Link to this post

    Hello Gianluc,

    Thank you for your question.

    You can use our RadInputPrompt control as shown here. When the prompt is closed you will be able to access the text through the returned event arguments.

    Let us know if you need further assistance.

    Regards,
    Todor
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Gianluc
    Gianluc avatar
    5 posts
    Member since:
    Nov 2013

    Posted 02 Jan 2014 Link to this post

    I'm trying to reproduce the example on this page http://www.telerik.com/help/windows-phone/radinputprompt-examples.html the section " Creating a control template for RadInputPrompt "

    I did everything as explained but the app crashes when I call

         
    RadInputPrompt.Show ( imageTemplate , " Title", new string [ ] { "yes", "no" });

    returning this message when debugging : -

    ExceptionObject { MS.Internal.WrappedException : Part name: PART_TextBox1
    Part type: Telerik.Windows.Controls.RadTextBox --- > Telerik.Windows.Controls.Exceptions.MissingTemplatePartException : Part name: PART_TextBox1
    Part type: Telerik.Windows.Controls.RadTextBox
       
    at Telerik.Windows.Controls.Primitives.RadControl.GetTemplatePart [T] (String PartName , Boolean ThrowException )
       
    at Telerik.Windows.Controls.InputPrompt.RadInputPromptControl.GetSingleLineTemplateParts ( )
       
    at Telerik.Windows.Controls.InputPrompt.RadInputPromptControl.OnApplyTemplate ( )
       
    at System.Windows.FrameworkElement.OnApplyTemplate (IntPtr nativeTarget )
       
    --- End of inner exception stack trace --- } System.Exception { } MS.Internal.WrappedException
  5. Todor
    Admin
    Todor avatar
    778 posts

    Posted 02 Jan 2014 Link to this post

    Hello Gianluc,

    Indeed, there is an issue with the provided example and we will change it with the next upload of the documentation.

    What needs to be changed is the name of the RadTextBox and RadPasswordBox inside the template. According to the example they are named PART_TextBox and PART_PasswordBox, but you need to change them to PART_TextBox1 and PART_PasswordBox1.

    Thank you for your report.

    Regards,
    Todor
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  6. Gianluc
    Gianluc avatar
    5 posts
    Member since:
    Nov 2013

    Posted 02 Jan 2014 Link to this post

    Perfect! Thanks! :)
Back to Top
DevCraft banner