The convention to bind the SelectedItem property of a ListBox to a property that is a singular version of the Items collection doesn't handle the word 'searches' properly.
For example a ListBox bound to RecentSearches will not bind it's SelectedItem property to SelectedRecentSearch.
I'm using the following modified code for ConventionManager.Singularize which handle this:
``` C#
ConventionManager.Singularize = original =>
{
if (original.EndsWith("ies"))
{
return original.TrimEnd('s').TrimEnd('e').TrimEnd('i') + "y";
}
else if (original.EndsWith("es"))
{
return original.TrimEnd('s').TrimEnd('e');
}
else
{
return original.TrimEnd('s');
}
};
```
Since binding to something like Searches in an app must come up maybe this is worth correcting?
For example a ListBox bound to RecentSearches will not bind it's SelectedItem property to SelectedRecentSearch.
I'm using the following modified code for ConventionManager.Singularize which handle this:
``` C#
ConventionManager.Singularize = original =>
{
if (original.EndsWith("ies"))
{
return original.TrimEnd('s').TrimEnd('e').TrimEnd('i') + "y";
}
else if (original.EndsWith("es"))
{
return original.TrimEnd('s').TrimEnd('e');
}
else
{
return original.TrimEnd('s');
}
};
```
Since binding to something like Searches in an app must come up maybe this is worth correcting?