Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type StringFloatOptionConverter() =
- interface IValueConverter with
- member this.Convert(value:obj, _targetType: Type, _parameter: obj, _culture: System.Globalization.CultureInfo) =
- let s = match value with
- | :? Core.Option<float> as opt ->
- match opt with
- | Some f -> sprintf "%.1f" f
- | None -> ""
- | _ -> ""
- s :> obj
- member this.ConvertBack(value:obj, _targetType: Type, _parameter: obj, _culture: System.Globalization.CultureInfo) =
- let o = match value with
- | :? string as str ->
- match Double.TryParse(str) with
- | (true, parsed) -> Some parsed
- | _ -> None
- | _ -> None
- o :> obj
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement