Hi
I have used XamNumericEditor and XamCurrencyEditor to display values in particular format like "Format=.000000"
Initially the format of value should not be displayed when we open the window.
After that,when the textbox is focused then it should display the format of value in the textbox.
Please find the attached file for clear picture.
Hi Saravanan,
I used your xaml and made a few changes. I think I ended up with what you want. I also add a xamNumericEditor for the Quantity property. You should include a ValueType reference there if your data is not of the default Double type.
<TextBlock Text="Contract Value:" Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="3,0,0,0"></TextBlock>
<igWPF:XamCurrencyEditor Grid.Row="0" Grid.Column="1" Width="120"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="5,3,0,3"
Mask="{}{double:-15.3}" Format="##,###,###.###"
DisplayMode="Raw" DataMode="Raw"
HorizontalContentAlignment="Right"
Text="{Binding ContractValue}"
IsEnabled="{Binding IsContractValueEnable}"/>
<TextBlock Text="Quantity:" Grid.Row="1" Grid.Column="0" Margin="3,0,0,0"
HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock>
<igWPF:XamNumericEditor Grid.Row="1" Grid.Column="1" Width="80"
HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,3,0,3"
InvalidValueBehavior="RevertValue"
PromptChar=""
Text="{Binding Quantity}"
ValueType="{x:Type sys:Int16}"
Mask="###" Format="###" >
</igWPF:XamNumericEditor>
<TextBlock Text="Premium Rate:" Grid.Row="2" Grid.Column="0" Margin="3,0,0,0"
<igWPF:XamNumericEditor Grid.Row="2" Grid.Column="1" Width="80"
Mask="{}{double:-2.6}" Format=" %"
DisplayMode="IncludeLiteralsWithPadding" DataMode="Raw"
Text="{Binding PremiumRate}"
IsEnabled="{Binding IsPremiumRateEnable}"
TabIndex="70">
<!-- I removed your reference to the SpinIncrement
SpinIncrement="0"
-->
<igWPF:XamNumericEditor.ValueConstraint>
<igWPF:ValueConstraint Nullable="False"/>
</igWPF:XamNumericEditor.ValueConstraint>
Let me know if this helps.
Hi Marianne
Your solution was helpful to some extent. I have queries for few more functionalities.
Kindly find the attached file for more details.
Regards
I'm not sure how you could eliminate the zero ahead of the decimal point once the control enters edit mode. At that point you still want to include commas and whether you use Mask ="{}{double:-15.6}" or something more like Mask="{}nnn,nnn,nnn,nnn,nnn,nnn.nnnnnn", once the control is in edit mode it shows the initial zero ahead of the decimal.
As for the way the text is displayed I worked with a ValueToDisplayTextConverter and created the look I think you want. I’ll attach my converter to the response.
Please let me know if you have any further questions.
I could not do format for Contract price and Premium Rate fields.
When i enter a value in contract price text box the value is displayed as 111.000000 as per the given format. But when i tab out from that field decimal values are disappeared and it is shown as 111. I need the value as 111.000000 even when i tab out of that field.
Similarly for Premium rate field.When i enter value and tab out of that field the value is disappered
Please find the attached file
I’ll attach a sample that is based on what I was trying to explain. Normally the Mask is used to format the control in edit mode. And Format is used to handle the control in display mode.
Because you have a variety of requirements, I added ValueToDisplayTextConverters for the controls showing the Contract Value and the Premium Rate.
You’ll see that I used XamCurrencyEditors, XamMaskedEditors and XamNumericEditors with similar results. I tried to add captions so you can see where each control type is being used. Since you aren't using the CurrencyEditor to show currency, I would recommend that you use the XamMaskedEditor.
Please let me know if you have any questions.
You have given solution in WPF4 version. But I am using WPF3 V12.1.
I will be thankful if you provide the solution in WPF3 V12.1
Hi Ramya,
I'm attaching a modified sample for 3.0 framework and NetAdvantage 2012.1. I needed to make some changes, removing the Input control and the ValueType property from the Editors. I also made some modifications to the converters because the MaskEditor is passing a string and not a decimal.
Thanks for the solution.Its working fine
Hello,
Do you have any other questions on this matter?
Sincerely,
Valerie
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support