InputScope setting for DataForm fields

6 posts, 0 answers
  1. Daniel
    Daniel avatar
    15 posts
    Member since:
    Jul 2013

    Posted 21 Aug 2013 Link to this post

    Is there a straightforward way to set the InputScope for Fields?

    I know i must be missing something simple.  This is such an awesome control, i can't imagine not being able to say a field is an email address and use the email keyboard...

    your assistance is appreciated,

    Dan
  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 23 Aug 2013 Link to this post

    Hi Daniel,

    Thanks for writing.

    InputScropes can be set via Styles. Each DataField instance exposes a EditorStyles property which can be used to define a style targeting the editor's type. For instance, if your DataField is associated with a string property, a RadTextBox instance will be created as an editor by default. So you can define a Style targeting the RadTextBox type, set the InputScope via it, and add it to the EditorStyles collection. This can happen easily in XAML.

    I hope this helps.

    Regards,
    Deyan
    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. KI performance
    KI performance avatar
    13 posts
    Member since:
    Jun 2013

    Posted 28 Aug 2013 Link to this post

    Hi there,

    I have the same problem. could you show a code-example? i always getting "line 0, column 0 " Xaml Errors!

    Thanks!
  5. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 28 Aug 2013 Link to this post

    Hi Sascha,

    Here's a very simple XAML snippet that demonstrates how this is done:

    <telerikInput:DataField.EditorStyles>
        <Style TargetType="telerikPrimitives:RadTextBox">
            <Setter Property="InputScope" Value="EmailUserName"/>
        </Style>
    </telerikInput:DataField.EditorStyles>

    I hope this helps.

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  6. Kevin
    Kevin avatar
    4 posts
    Member since:
    Apr 2012

    Posted 15 Nov 2013 Link to this post

    This does not appear to be working in the latest release (2013.3.1016.3040). Is this a known bug?

    I've tried setting the InputScope style exactly as shown, but it's always ignored no matter what scope value I try to use. I only ever get the standard input keyboard. Here's my entire DataField:

    <telerikInput:DataField Header="username" TargetProperty="UserName">
        <telerikInput:DataField.EditorStyles>
            <Style TargetType="telerikPrimitives:RadTextBox">
                <Setter Property="Watermark" Value="username or email"/>
            </Style>
            <Style TargetType="telerikPrimitives:RadTextBox">
                <Setter Property="InputScope" Value="EmailUserName" />
            </Style>
        </telerikInput:DataField.EditorStyles>
        <telerikInput:DataField.Validators>
            <telerikInput:NonEmptyStringValidator/>
        </telerikInput:DataField.Validators>
    </telerikInput:DataField>
  7. Kevin
    Kevin avatar
    4 posts
    Member since:
    Apr 2012

    Posted 15 Nov 2013 Link to this post

    Nevermind that last post. PEBKAC.  :-)

    I realized that I had copy/pasted the entire <Style> block for the watermark to add the style for the InputScope instead of just adding another Setter to the existing <Style>. Once I fixed that it works fine ... obviously. :-)
Back to Top
DevCraft banner