have a datatable which is being inserted with doubl.NaN when we dont have values. What i want to do is whenever i see double.Nan i want to put "-" instead, therefore i have a converter with the following code:
if (value.ToString() == double.NaN.ToString())
{
return "-";
}
everything worked perfectly on "en-us" culture, but when we use different culture (like "zn-cn") it doesnt work, due to the fact that "double.NaN.ToString()" results with a chinese word where value.ToString() is the normal "NaN".
i tried using double.parse() using the converters, nothing worked.
Update - ok the problem is that the converter gets the object as string and not as double this is the Xaml:
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border Background="Transparent" Padding="10 8" BorderBrush="Transparent" BorderThickness="1">
<Border.Resources>
<Style TargetType="ToolTip">
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="HasDropShadow" Value="False"/>
<Setter Property="VerticalOffset" Value="-46"/>
<Setter Property="HorizontalOffset" Value="10"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolTip">
<General:TextTooltip TitleStyle="{StaticResource NumericTableToolTipTitleStyle}" Content="{TemplateBinding Content}" ContentStringFormat="G" ContentStyle="{StaticResource NumericTableToolTipContentStyle}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Border.Resources>
<TextBlock x:Name="tbCellText" Text="{Binding RelativeSource={RelativeSource TemplatedParent},
Path=Content.Text, Converter={StaticResource NumericTableCellContentConverter}, ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}"
ToolTip="{Binding ElementName=tbCellText, Path=Text}"
TextWrapping="Wrap"/>
</Border>
</ControlTemplate>
is there any way to preserve the type of the object?
i know i could just do a comparison with "NaN" but i would like more generic solution for that matter.