Hello.
I have a problem with the XamWebNumericEditor and XamWebMaskedEditor. If I put one of these controls on my view and run the application, it crashes with the following error:
AG_E_PARSER_BAD_TYPE [Line: 450 Position: 117]
(see attached screenshot).
The code in XAML is quite simple:<igEdit:XamWebNumericEditor Canvas.Left="682" Canvas.Top="57" Text="100" TextWrapping="NoWrap" />
or
<igEdit:XamWebMaskedEditor Canvas.Left="698" Canvas.Top="65" Text="100" TextWrapping="Wrap" Mask="999"/>
System information:OS: Windows 7 Ultimate 32BitSilverlight controls v9.2Expression Studio 3 SP1Language: German
Any ideas what the problem could be?
Ralf
Hi Ralf,
Could you provide some more information, for example:
-which of the two XAML code lines above is at the specified location (line 450)?
-also, if possible, please provide some more of the XAML code, in what container is placed the editor, etc.
Thanks in advance,
Hi Stoimen,
In line 450 of the XAML-file the following code is found:
<igEdit:XamWebNumericEditor Canvas.Left="682" Canvas.Top="57" Text="100" TextWrapping="NoWrap" />
The page is structured as followes:
<Border> <Canvas> <igEdit:XamWebNumericEditor /> </Canvas></Border>
So the editor conttrol resides on a canvas within a border. I need a canvas because I have a lot of controls (textblock and textbox). A grid with the corresponding rows and columns would drive me nuts;-) A canvas is much easier for me to handle. I don't hope that the border or canvas is causing the problem.
I could not reproduce the problem. Could you attach an archive file that contains your application with this xaml file?
Also, if you want your default value to be 100 you have to set it in XamWebNumericEditor Value property in code behind, Value=100.0. Numeric editor default ValueType is Double and the value from the Text property that is a string is ignored.
Thanks,
Dimitrina Siderova
Software Engineer in Test
Hi Dimitrina.
Thanks for your help.I tried it in new SL app and it seems to work. No problems at the moment. To locate the problem in my "real" app will be very difficult, I think. I'm working with SL for about 3 weeks and it's all very new to me.
But what I would like to know is, how can I specify the ValueType property in XAML? For e.g. if I would like to have a input field for integers only. There seems to be a "problem" in Blend3. I would declare the ValueType in XAML only and not in code behind, because I use Unity and PRISM for my app and don't want to place any code in the code behind file.
Could you please show me some examples for an integer and a double (e.g. "999.9" or "9.999")?
Thank you.
Hello Prakhecha,
Yes, it is possible to bind the value of XamWebNumericEditor in XAML – you should do something like:
<ig:XamWebNumericEditor x:Name=”Age” Value="{Binding Path=Age, Mode=TwoWay}" />
I hope this satisfies your question.Sincerely, Tanya
Hi,
Is it possible to BIND the Value of numeric editor in xaml(not code behind) as we do for textbox?
TextBox Text='{Binding filed_name, Mode=TwoWay}'
Ok, so I will do that in code behind.Again, thank you very much for your help.
Kind regards,
Yes, it is not possible to assign a default value in XAML. You should do this from code behind and the value has to be in the appropriate type that you use.
Regards,
Thank you very much for the detailed explanation. Your sample code works very well. There is only one thing left: How can I specify a default value in XAML? If I use the value property for a numeric editor control (ValueType="System:Double") and try to assign a value e.g. 12,1 I get the error "The new assigned value 12,1 is not of specified type:Double".
Is it not possible to assign a default value in XAML so that I have to use code behind instead?