Error MSB8036 The Windows SDK version 10.0.17763.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
public partial class App : Application
{ public static ApplicationSettingsSettings { get; set; }
protected override voidOnStartup(StartupEventArgs e)
{ // Get command line arguments (if any) to overwrite default settings varcommandLineArgsDict = new Dictionary<string, string>(); for (int index = 0; index < e.Args.Length; index +=2)
{
commandLineArgsDict.Add(e.Args[index], e.Args[index +1]);
}
Settings = new ApplicationSettings();
Settings.Initialize(commandLineArgsDict);
public class MainViewModel : BindableBase
{ private string_statusBarText; public stringStatusBarText
{ get { return _statusBarText; } set { SetProperty(ref _statusBarText, value); }
}
public MainViewModel()
{
}
}
然后创建一个名为ViewModelLocator.cs的类:
public static classViewModelLocator
{ private static MainViewModel_main; public static MainViewModelMain
{ get { return _main ??= new MainViewModel(); }
}
}
[Bindable(BindableSupport.Default)] public class StringToBooleanConverter : IValueConverter
{ public objectConvert(objectvalue, Type targetType, objectparameter, CultureInfoculture)
{ if (value ==null || !(value is string))
{ returnfalse;
}
string stringValue = value as string;
return !string.IsNullOrWhiteSpace(stringValue.Trim());
} public objectConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ throw new NotImplementedException();
}
}
添加另一个名为StringToVisibilityConverter.cs的类:
[Bindable(BindableSupport.Default)] public class StringToVisibilityConverter : IValueConverter
{
public objectConvert(object value, Type targetType, object parameter, CultureInfo culture)
{ if (value == null || !(value is string))
{ return Visibility.Collapsed;
}
string stringValue = value as string;
return string.IsNullOrWhiteSpace(stringValue.Trim()) ? Visibility.Collapsed : (object)Visibility.Visible;
} public objectConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{ throw new NotImplementedException();
}
}