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

RadDatePicker Culture defiend in style

1 Answer 76 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Josip Jaic
Top achievements
Rank 2
Josip Jaic asked on 29 Jul 2009, 02:27 PM
Hi,

Today i run into problem with RadDatePicker (latest dev Q2 2009)
which took me some time to solve

This is working OK

 

 

<telerikInput:RadDatePicker

 

 

x:Name="datePickerHBC_CreateDate"

 

 

Style="{StaticResource DefaultDateTimePicker}"

 

 

SelectionChanged="datePickerHBC_CreateDate_SelectionChanged"

 

 

IsEnabled="False"

 

 

Culture="hr-HR"

 

 

/>

 

 

 

<Style x:Key="DefaultDateTimePicker" TargetType="telerikInput:RadDatePicker">

 

 

 

 

 

 

<Setter Property="HorizontalAlignment" Value="Left"/>

 

 

 

 

 

 

<Setter Property="VerticalAlignment" Value="Center"/>

 

 

 

 

 

 

<Setter Property="Width" Value="90"/>

 

 

 

 

 

 

<Setter Property="Height" Value="20"/>

 

 

 

 

 

 

<Setter Property="Margin" Value="1"/>

 

 

 

</Style>

But if you delete line Culture="hr-HR"
and add setter in style
<Setter Property="Culture" Value="hr-HR"/> 
 this is throwing unhandled exception (which did not point to error)

 [Line: 0 Position: 0]
   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.ConvertStringToTypedCValue(IntPtr pContext, UInt32 cClrTypeName, String clrTypeName, UInt32 cValue, String value, CValue& outVal, Int32& typeIndex)
   at MS.Internal.SilverlightTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at MS.Internal.FrameworkCallbacks.SetValueCustom(IntPtr nativeRoot, IntPtr nativeTarget, UInt32 propertyId, String attrValue, CValue& propertyValue, Int32 typeIndex, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason)


Hope this is helping someone not to make same mistake as I did

 

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 31 Jul 2009, 07:44 AM
Hello Josip Jaic,

For now it is not possible to set a Culture in the Setter of a style in the control, because the Silverlight parser is trying to set the string as a culture and not as a CultureInfo. Whereas if you set the culture directly in the control as a value, it is implicitly converted as a CultureInfo.

Regards,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
DatePicker
Asked by
Josip Jaic
Top achievements
Rank 2
Answers by
Kaloyan
Telerik team
Share this question
or