Hi, I hope someone can help me with this one...
Unfortunately to put all the code in is just not feasible, however.. I am implementing the MVVM pattern, I have a content presenter that displays a UserControl.
The UserControl has a number of items on it with some basic CRUD functions, e.g. Edit, Delete, etc.
I have set up the Control, so that the commands can only be enabled when an item is selected. e.g.
/// <summary>
/// Returns a command that makes a new Invoice
/// </summary>
public ICommand CommandViewInvoice
{
get
{
if (_commandViewInvoice == null)
{
_commandViewInvoice = new DelegateCommand(ViewInvoice, CanCommandViewInvoice);
}
return _commandViewInvoice;
}
}
However, for some reason sometimes the command is enabled, and sometimes it isnt - even though I am viewing exaclty the same items, and nothing has changed. In fact, if I just go in and out of the view 10 times, 9 out of ten times it will work correctly, but "sometimes" it just wont be enabled.
I cannot find a way to consistently replicate the error... it just sometimes happens and sometimes doesnt.
If anyone has come across a similar error, or has any useful suggestions on how I can make sure that these commands function correctly, or how I can debug this one, you will have my utmost gratitude...