I read the article to learn how to define a custom data field. The RadNumericUpDown seems very simple. Then I want to use the RadMaskedTextInput to define a field of IP address. I get some code snippets from another sdk example.
<
telerik:RadMaskedTextInput
Grid.Row
=
"0"
x:Name
=
"firstInput"
Grid.Column
=
"1"
Margin
=
"10 5 10 5"
HorizontalAlignment
=
"Stretch"
TextMode
=
"PlainText"
Mask
=
"###.###.###.###"
Value
=
"{Binding IpValue, Mode=OneWay, ValidatesOnExceptions=True, Converter={StaticResource converter}}"
Text
=
"{Binding IpText, Mode=OneWayToSource, ValidatesOnExceptions=True, UpdateSourceTrigger=LostFocus}"
/>
Note that there are two values to be bound to. Sorry for my stupidity and i can't come up a way to do that according to the way stated in that article.
Jingfei
6 Answers, 1 is accepted
I would appreciate a lot if someone could give me some ideas or guidelines. Meanwhile, i am preparing a sample project to demonstrate what i want and the attempts i've tried but failed. I think it would help others to understand what i'm talking about.
-J
Could you please open a support ticket and provide a runnable sample demonstrating the exact implementation that you are using so we could inspect it locally and provide the best possible solution.
Regards,
Martin Vatev
Telerik
Hi Martin,
I don't think i can create a support ticket. And i mirrored the git repository here git@github.com:hobbycamp/xaml-sdk.git and create a branch add-maskedinput-to-dataform. Could you help me to take a closer look at it and shed me the light how to do it?
Thanks a lot,
-J
Taking a closer look of your project, I understood what the problem is. The type of IpValue property in Employee.cs class is IpAddressPresentation and this property is bound to
RadMaskedTextInput.Value which expects property of type string.
To get it to working properly you must change IpValue type from IpAddressPresentation to string.
Regards,
Martin Vatev
Telerik
Hi Martin,
Thanks for your time to take a closer at my project. The reason I use a IPAddressPresentation is RadMaskedTextInput can't maintain the IP address properly when users begin edit the content. The Value property of RadMaskedTextInput doesn't contain the '.' which is a separator of the mask.
If I give a string value of '192.168.100.100', it would become '192168100100' and when I can change the first '100' to be '1', then it returns '1921681100'. It's impossible to parse what the real IP address is. But the Text property of RadMaskedTextInput can maintain the information, that's why I mix them up in my project. However, the data field of RadDataForm only support bind to one property. I don't know what else good solution is now.
Hope make myself clear.
Thanks,
-J