This is a migrated thread and some comments may be shown as answers.

Culture Error when use RadMaskedTextBox inside GridViewDataColumn

2 Answers 102 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sha
Top achievements
Rank 1
Sha asked on 20 Nov 2012, 11:21 AM
Hi,

GridViewDataColumn have the value is 300,00.
Set Culture property to "fr-FR" of RadMaskedTextBox in XAML view.
On runtime, I click on that field to change to inline editing mode
=> RadMaskedTextBox display 300,00 --> correct

 

<telerik:GridViewDataColumn DataMemberBinding="{Binding MyValue, 
                                    Converter
={StaticResource EmptyToZeroConverter}}">

    <telerik:GridViewDataColumn.CellEditTemplate>

       <DataTemplate>

          <telerik:RadMaskedTextBox Value="{Binding MyValue, 
                          Converter
={StaticResource EmptyToZeroConverter}, Mode=TwoWay}" 
                  Mask
="n" MaskType="Numeric"

                   Culture="fr-FR"

                   />

       </DataTemplate>

    </telerik:GridViewDataColumn.CellEditTemplate>

 </telerik:GridViewDataColumn>

But,
when set binding to Culture property of RadMaskedTextBox in XAML view.
On runtime, I click on that field to change to inline editing mode
=> RadMaskedTextBox display 30 000,00 --> incorrect

<

telerik:GridViewDataColumn DataMemberBinding="{Binding MyValue, 
                                     Converter
={StaticResource EmptyToZeroConverter}}">

    <telerik:GridViewDataColumn.CellEditTemplate>

       <DataTemplate>

          <telerik:RadMaskedTextBox Value="{Binding MyValue, 
                            Converter
={StaticResource EmptyToZeroConverter}, Mode=TwoWay}" 
                  Mask
="n" MaskType="Numeric"

                   Culture="{Binding DataContext.SelectedCurrencyCulture, 
                           RelativeSource
={RelativeSource AncestorType
=telerik:RadWindow}}"

                   />

       </DataTemplate>

    </telerik:GridViewDataColumn.CellEditTemplate>

 </telerik:GridViewDataColumn>

  

 

When I use RadMaskedTextBox outside GridView and set binding to Culture, RadMaskedTextBox work correct.

<telerik:RadMaskedTextBox Value="{Binding MyValue, 
                   Converter
={StaticResource EmptyToZeroConverter}, Mode=TwoWay}" 
         Mask
="n" MaskType="Numeric"

 

         Culture="{Binding DataContext.SelectedCurrencyCulture, 
                   RelativeSource
={RelativeSource AncestorType
=telerik:RadWindow}}"

          />

 

Admin please help me to resolve this problem ASAP. I really need it...
Thanks you so much,
Sha Daw.






2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 20 Nov 2012, 04:08 PM
Hi,

It seems that the culture is not resolved. The problem should be because of the RelativeSource you have used for the binding. Please expose the source as a Static Resource and specify the source through it.

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sha
Top achievements
Rank 1
answered on 21 Nov 2012, 02:17 AM
Hi,

How can i expose the source as a Static Resource? I have tried this way... but it cannot find Resource with Key/Name MyWindow...?

<telerik:RadWindow x:Key="MyWindow">
    <telerik:RadGridView>

      <telerik:RadGridView.Columns>

        <telerik:GridViewDataColumn DataMemberBinding="{Binding MyValue, 
                                Converter
={StaticResource EmptyToZeroConverter}}">

           <telerik:GridViewDataColumn.CellEditTemplate>

              <DataTemplate>

                 <telerik:RadMaskedTextBox Value="{Binding MyValue, 
                            Converter
={StaticResource EmptyToZeroConverter}, Mode=TwoWay}" 
                       Mask
="n" MaskType="Numeric" 
                       Culture="{Binding DataContext.SelectedCurrencyCulture,

                                                                                   Source={StaticResource MyWindow}}"

                           />

              </DataTemplate>

           </telerik:GridViewDataColumn.CellEditTemplate>

        </telerik:GridViewDataColumn
           </telerik:RadGridView.Columns>

     </telerik:RadGridView>

 </telerik:RadWindow>

 

 

Please help me to resolve this problem ASAP. I really need it...
Thanks you so much,
Sha Daw.

Tags
GridView
Asked by
Sha
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Sha
Top achievements
Rank 1
Share this question
or