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

TextBox in MessageBox

4 Answers 140 Views
MessageBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gianluc
Top achievements
Rank 1
Gianluc asked on 02 Jan 2014, 02:47 PM
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>

4 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 02 Jan 2014, 02:57 PM
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.
0
Gianluc
Top achievements
Rank 1
answered on 02 Jan 2014, 03:40 PM
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
0
Todor
Telerik team
answered on 02 Jan 2014, 03:51 PM
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.
0
Gianluc
Top achievements
Rank 1
answered on 02 Jan 2014, 06:31 PM
Perfect! Thanks! :)
Tags
MessageBox
Asked by
Gianluc
Top achievements
Rank 1
Answers by
Todor
Telerik team
Gianluc
Top achievements
Rank 1
Share this question
or