private static string XamlEncode(string inputStr) { return string.IsNullOrEmpty(inputStr) ? inputStr : inputStr.Replace("&", "&") .Replace("<", "<") .Replace(">", ">") .Replace("\"", """) .Replace("'", "'"); }