Beispiel #1
0
        public object?ConvertBack(object value, Type targetType, object parameter, _CultureInfo culture)
        {
            var stringValue = (string?)value;

            if (string.IsNullOrWhiteSpace(stringValue))
            {
                return(null);
            }
            else
            {
                stringValue = ManifestUtility.ReplaceTokenWithMetadata(stringValue);
                if (NuGetVersion.TryParse(stringValue, out var version))
                {
                    return(version);
                }
                else
                {
                    return(DependencyProperty.UnsetValue);
                }
            }
        }
Beispiel #2
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var stringValue = (string)value;

            if (String.IsNullOrEmpty(stringValue))
            {
                return(null);
            }
            else
            {
                stringValue = ManifestUtility.ReplaceTokenWithMetadata(stringValue);

                if (VersionRange.TryParse(stringValue, out VersionRange versionSpec))
                {
                    return(versionSpec);
                }
                else
                {
                    return(DependencyProperty.UnsetValue);
                }
            }
        }