private void XamlToGrid_Click(object sender, RoutedEventArgs e) { ResxList.Clear(); if (!string.IsNullOrEmpty(XAMLText)) { foreach (string line in XAMLText.Split('\n')) { //find out all Resx tags if (line.Contains("{Resx")) { if (IsCommonIncluded || !line.Contains("Common.")) { ResxList.Add(new ResxRow(line)); } } } } }
private void XamlToGrid_Click(object sender, RoutedEventArgs e) { ResxList.Clear(); if (!string.IsNullOrEmpty(XAMLText)) { foreach (string line in XAMLText.Split('\n')) { string keyWord = "{Binding "; List <string> excludeWord = new List <string>(); excludeWord.Add("ElementName"); //find out all Resx tags if (line.Contains(keyWord)) { //Exclude useless lines if (excludeWord.Any(word => line.Contains(word))) { //Excluded continue; } else { string name; // index of binding end int endIndex; endIndex = line.IndexOf(","); if (endIndex < 0) { endIndex = line.IndexOf("}\""); } // index of binding start int startIndex = line.IndexOf(keyWord); name = line.Substring(startIndex + keyWord.Length, endIndex - startIndex - keyWord.Length); ResxList.Add(new NameValue() { Name = name }); } } } } }