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

Buttons Width

4 Answers 60 Views
InputPrompt
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Romasz
Top achievements
Rank 1
Romasz asked on 01 Jan 2014, 09:40 PM

Hello,

I'm trying to use InputPrompt with three buttons in one line. I created own DataTemplate for this purpose, but it seems that buttons regards its content have minimum width - so that only two buttons can be placed horizontally. Is it possible to change buttons width so that there can be more buttons in one line?

I've used such a code:

<DataTemplate x:Key="ButtonsTemplate">
    <StackPanel x:Name="PART_ButtonsPanel" Orientation="Horizontal"/>
</DataTemplate>
And in code behind:

DataTemplate buttonsTemplate = (DataTemplate)this.Resources["ButtonsTemplate"];
 
InputPromptClosedEventArgs result = await RadInputPrompt.ShowAsync(buttonsTemplate: buttonsTemplate, title: "My Title", buttonsContent: new string[] { "OK", "Not OK", "Cancel" },
    message: "My message", isCheckBoxChecked: true, checkBoxContent: "Please check this checkbox", inputMode: InputMode.Text,
    vibrate: false, horizontalAlignment: System.Windows.HorizontalAlignment.Stretch, verticalAlignment: System.Windows.VerticalAlignment.Top);


4 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 02 Jan 2014, 03:18 PM
Hi Tomasz,

Thank you for your question.

By design, when the buttons in RadInputPrompt are 3 or more, each of them is displayed on a different line. Otherwise, the buttons are on one row. You can't change this behavior because it is not part of the style, but part of the code. If you need fully customized layout for your input prompt, you can use RadWindow and manually arrange all the content as desired.

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
Romasz
Top achievements
Rank 1
answered on 02 Jan 2014, 03:38 PM

Hello Todor,

Thank you for the answer. As I'm finishing my project now I'll use standard InputPrompt with buttonsDatatemplate from RadWrapPanel - then I've two buttons in one line and third below. It will be sufficient for now, your idea to use RaWindow may be a good solution - I'll try it within next update.

Then I have one more question - is it possible that keyboard won't show when InputPrompt is invoked, but only when the user taps TextBox?

Regards,

Tomasz

0
Accepted
Todor
Telerik team
answered on 02 Jan 2014, 04:13 PM
Hello Tomasz,

The keyboard is automatically shown when the input prompt control takes the focus. In order to hide it you need to make sure that the focus returns to the page when it is taken from the input prompt. Add the following code the constructor of your page:
this.LostFocus += this.MainPage_LostFocus;
And add the following event handler:
private void MainPage_LostFocus(object sender, RoutedEventArgs e)
{
    if (e.OriginalSource is Telerik.Windows.Controls.InputPrompt.RadInputPromptControl)
    {
        this.Focus();
    }
}

I hope this helps.

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
Romasz
Top achievements
Rank 1
answered on 02 Jan 2014, 04:38 PM

Hello Todor,

yeah - this is an easy solution and good enough. Thank you.

Regards,

 Tomasz

Tags
InputPrompt
Asked by
Romasz
Top achievements
Rank 1
Answers by
Todor
Telerik team
Romasz
Top achievements
Rank 1
Share this question
or