Telerik Forums
UI for WPF Forum
2 answers
75 views

Reading the telerik help on this control is not very helpful at all.

I just want a maskedinput control that is the following [0-9]\+[0-5][0-9]

M+SS, so it would display --> _+__

Minutes, can be 0-9

Seconds, 00 to 59

John
Top achievements
Rank 1
 answered on 07 Aug 2020
2 answers
233 views

I'd like to be able to use a masked input control to allow the user to enter a hexadecimal number representing a color value (ARGB) e.g. #FF445566 or 0x445566. Is there some way I can use one of the mask controls to achieve this?

Thanks
Pete

Vladimir Stoyanov
Telerik team
 answered on 06 Jul 2020
2 answers
256 views

How can I prevent the user from entering or pasting text that contains newlines in a RadMaskedTextInput. The user should also not be able to enter a newline using Ctrl+Return or Shift+Return or Alt+Return. 

Setting the `AcceptsReturn` property to `false` has no effect at all. And its documentation states

> "Gets or sets a value indicating whether newline is accepted when the mask supports multiline."

Unfortunately the docs fail to mention how to set set a mask that prevents multiline.

Petar Mladenov
Telerik team
 answered on 02 Jul 2020
4 answers
46 views

Hello,

 

I have a RadMaskedInput to gather information on a form. I have a button that saves the information on the form, then clears the form. When I click the RadMaskedInput a second time to enter a new value, it uses the a cache of the previously entered value, which I have to delete before I can continue typing or some parts of the previous text will remain with my new text. Is there a way to disable this caching so that that RadMaskedInput never shows previous data that was entered?

 

Thanks.

Vladimir Stoyanov
Telerik team
 answered on 25 Jun 2020
8 answers
286 views
Hi Telerik,

I am using a RadMaskedDateTimeInput control in my application. It is being used in a RadGridView's CellEditTemplate edit mode and the value is bound to a TimeSpan object with the property [ Mask = HH:mm ]

When I enter edit mode in run time it seems to be displaying/bound to Today.Now and/or DateTime.Now (It is only showing the current Hour/Minutes). Is this a known bug or should I be using another InputMask control to accomplish this. I only want to see the correct time in this format 00:00 [HH:mm]

Thanks!
Petar Mladenov
Telerik team
 answered on 20 Apr 2020
1 answer
506 views

Hello I encountered a bug or odd behaviour in the RadNumericUpDown control. I use caliburn micro as a MVVM framework to bind a simple property to the Value of the control. On KeyDown I check the value and if a condition fails, I reset the value to the last valid state.

The Problem is that the Value is not updated despite the PropertyChanged event firing correctly. The value is updated after the focus is lost.

 

class ShellViewModel : Screen
{
    /// <summary>
    /// Value before change
    /// </summary>
    protected double ValueBeforeChange;
 
    private double value;
 
    /// <summary>
    /// Gets or sets the value
    /// </summary>
    public new double Value
    {
        get => value;
        set
        {
            if (!(Math.Abs(value - this.value) > double.Epsilon))
            {
                return;
            }
 
            Console.WriteLine($"Value changed to {value}");
            this.value = value;
            NotifyOfPropertyChange(() => Value);
        }
    }
 
    public ShellViewModel()
    {
        Value = 10;
        ValueBeforeChange = Value;
    }
 
    public new void KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Return || e.Key == Key.Enter)
        {
            if (Value > 20)
            {
                Value = ValueBeforeChange;
            }
            else
            {
                ValueBeforeChange = Value;
            }
        }
    }
}

 

<UserControl x:Class="RadUpDownBug.Views.ShellView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
    <StackPanel>
        <telerik:RadNumericUpDown x:Name="Numeric"
                                  FontSize="24"
                                  ValueFormat="Numeric"
                                  NumberDecimalDigits="2"
                                  Value="{Binding Value, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                  ShowButtons="False"
                                  UpdateValueEvent="PropertyChanged"
                                  cal:Message.Attach="[Event KeyDown] = [Action  KeyDown($this,$eventArgs)];" Margin="0" />
        <TextBox></TextBox>
    </StackPanel>
</UserControl>

 

So entering a value above 20 and pressing enter should result in the control displaying the last value (10 at the beginning) But it does not. If you click on the TextBox the control is correctly updated.

Why does this happen and how do I fix this?

Dinko | Tech Support Engineer
Telerik team
 answered on 08 Apr 2020
3 answers
199 views

I'm trying to only allow users to type in 6 digits integer with prefix "CA", and now I can only type in one leading zero, not multiple zeros. 

Here is my code, and ProjectNumber is a nullable double. 

<telerik:RadMaskedNumericInput                     

Grid.Column="0"                   

Margin="25, 0, 0, 10"                    

Width="100"                   

Mask="CA#####"                   

Placeholder=""                            

AutoFillZeros="False"                   

AutoFillNumberGroupSeparators ="False"                   

IsClearButtonVisible="False"                                       

AllowInvalidValues="True"                   

Validation.ErrorTemplate="{x:Null}"                   

maskedInput:MaskedInputExtensions.Minimum="0"                     

HorizontalContentAlignment="Left"                   

HorizontalAlignment="Left"                                        

Value="{Binding Path=(viewModel:IProjectFolderViewModel.ProjectNumber), Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>

 

Also, the prefix 'CA' only appears after users click on the input box or type in something. is there anyway that we could show the prefix all the time. 

Martin Ivanov
Telerik team
 answered on 19 Mar 2020
1 answer
200 views

I am trying to validate a Textbox that will hold an IP Address. I have a working example that works as expected

 

 <telerik:RadMaskedTextInput ValidationRegex="{x:Static maskedInput:ValidationHelper.IP}" x:Name="hueIpAddress" Height="23" Margin="203,39,0,0" VerticalAlignment="Top" Width="120" HorizontalAlignment="Left" 
                                    EmptyContent="Enter IP Address"
                                    InputBehavior="Insert"                 
                                    Mask="{Binding Path=Text, ElementName=Mask, Mode=TwoWay}"
                                    IsClearButtonVisible="False"
                                    SelectionOnFocus="CaretToEnd"
                                    TextMode="PlainText" 
                                    UpdateValueEvent="ProperyChanged"     />

 

But no matter what I do, I cannot get an event to fire when the value is updated. I have tried ValueChanged and ValueChanging, but none fire as expected, and I am not interested in playing the PreviewTextInput/KeyDown game which is unreliable. I want to be able to update a label on my page with the current value of the text box, and doing it via the handle method as I will need to do other stuff as well. 

Dinko | Tech Support Engineer
Telerik team
 answered on 12 Mar 2020
1 answer
69 views

Can someone please inform me how you can set this type of control either in xaml or code behind to be in TypeOver mode rather than Insert mode?

I have searched the web and can't seem to find anything...

Petar Mladenov
Telerik team
 answered on 05 Feb 2020
8 answers
134 views

Hi,

I have this RadMaskedTextInput:

<telerik:RadMaskedTextInput IsClearButtonVisible="True" TextMode="PlainText"  Placeholder=" " Mask="a4/>a3" Margin="2,0,2,0" AcceptsReturn="False" HorizontalAlignment="Stretch" Value="{Binding FilterPasse}" ValueMode="IncludeLiterals" SelectionOnFocus="CaretToBeginning"/>

Following implicit style is used

<Style x:Key="DefaultTelerikMaskedTextInputStyle" TargetType="telerik:RadMaskedTextInput" BasedOn="{StaticResource RadMaskedTextInputStyle}">
    <Setter Property="MinHeight" Value="{StaticResource DefaultMinimumHeight}"/>
    <Setter Property="FontFamily" Value="{StaticResource DefaultFont}"/>
    <Setter Property="FontSize" Value="{StaticResource DefaultFontSize}"/>
    <Setter Property="FontWeight" Value="{StaticResource DefaultFontWeight}"/>
    <Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorTemplate}"/>
 
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="True">
            <Setter Property="Background" Value="{StaticResource DefaultTextBoxBackgroundColor}"/>
        </Trigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Background" Value="{StaticResource DefaultTextBoxDisabledBackgroundColor}"/>
        </Trigger>
        <Trigger Property="IsFocused" Value="True">
            <Setter Property="Background" Value="{StaticResource DefaultTextBoxIsFocusedBackgroundColor}"/>
        </Trigger>
        <Trigger Property="IsReadOnly" Value="True">
            <Setter Property="Background" Value="{StaticResource DefaultTextBoxIsReadOnlyBackgroundColor}"/>
        </Trigger>
    </Style.Triggers>
</Style>
<Style TargetType="{x:Type telerik:RadMaskedTextInput}" BasedOn="{StaticResource DefaultTelerikMaskedTextInputStyle}"/>

 

When running the application the slash (in the mask) is shown twice (see attached pictures). Any ideas why ?

Regards,
Hans

Hans
Top achievements
Rank 1
Veteran
 answered on 04 Dec 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?