Would it eventually be possible to use ViewModels generated with an MVVM framework such as uFrame with Noesis GUI? uFrame is a MVVM framework for Unity. See:
http://invertgamestudios.com/
I have tried to remake the Command sample in combination with uFrame. uFrame's generated ViewModel for Noesis' Command sample looks like this:
public partial class NoesisChatViewModel : ViewModel {
public readonly P<System.String> _InputProperty = new P<string>();
public readonly P<System.String> _OutputProperty = new P<string>();
private ICommand _SayHelloCommand;
public virtual string Input {
get {
return _InputProperty.Value;
}
set {
_InputProperty.Value = value;
}
}
public virtual string Output {
get {
return _OutputProperty.Value;
}
set {
_OutputProperty.Value = value;
}
}
public virtual ICommand SayHelloCommand {
get {
return _SayHelloCommand;
}
set {
_SayHelloCommand = value;
}
}
}
As you can see it's currently not possible to use the ViewModel as a resource in the XAML because:
1) It doesn't derive from Noesis.SerializableComponent. However if I understand correctly you are looking to lift that requirement.
2) uFrame's generated files are all in the global namespace, but fortunately namespaces in code generation are on the roadmap for uFrame 1.3.
3) uFrame's ICommand is not the same as BaseCommand nor the same as Microsoft's ICommand. Would that be an obstacle? The uFrame developers are about to revise some core stuff in the following next weeks and are now open to suggestions, so maybe you could get in touch with them. Currently uFrame's ICommand looks like this:
public delegate void CommandEvent();
/// <summary>
/// The base command interface for implementing a command in a ViewModel
/// </summary>
public interface ICommand
{
event CommandEvent OnCommandExecuted;
event CommandEvent OnCommandExecuting;
object Sender { get; set; }
object Parameter { get; set; }
IEnumerator Execute();
}
In the meantime I know I can write Views to bind ViewModel properties to XAML controls, but it's redundant and error-prone. Would be a much more elegant solution if you could just plug in the ViewModel.