@dale, mostly suggested approach here for writing eto UI is in C# as far as I know. Developer samples cover also only C# (unless I missed something).
UI in eto can be written in:
One .cs file, no preview
Two files: .cs (code behind) and .eto.cs (view), giving access to preview in Visual Studio with eto extension
Two files: .xeto (xaml like view) and .xeto.cs (code behind), giving access to preview in Visual Studio with eto extension
Two files: .jeto (json like view) and .jeto.cs (code behind), giving access to preview in Visual Studio with eto extension.
From some time I have experience with WPF, and I feel writing UI in xaml is more efficient than pure C#. I know that preview for eto is not the same as for WPF, but it is still better than nothing.
Is it possible to prepare sample similar to
https://github.com/mcneel/rhino-developer-samples/tree/7/rhinocommon/cs/SampleCsEto using xeto with ViewModels, Binding and ICommands (if supported by eto). I saw RhinoUI have some internal ViewModel class but I did not see anything for DelegateCommand/RelayCommand. I feel seperating those will be more MVVM like and help to create more clean and testable code.
Also there might be less questions about MVVM on forum
Trying to replace eto with xaml like Avalonia may need to reference 100mb of Avalonia dlls
and I am not a fan of that.
I create all of my Eto forms and view models using straight C#, and I don’t know anything about xeto or jeto, etc… Sorry.
While this is probably not exactly what you are looking for, I’ve experimented a bit with the .xeto/.cs duality and am going to share my experiences here.
It’s very much like .xaml/.cs but you’ll need to use eto components instead of wpf. So you’ll be missing out on objects like
You can see the files here:
I just managed to link a custom drawable object also and I had some challenges with that. You can read about that here
Custom Drawable objects in xeto/xaml · picoe/Eto · Discussion #2529 · GitHub
What also annoys me is that there is the full RhinoWindows Nuget package which has been
recommended here on forum, but as I see much of the code is totally undocumented. Also it’s tough to know whether to use this or not since RhinoWindows is not crossplatform. Which means that those viewmodels logics should live in rhinocommon and not rhinowindows.:
There is an example of MVVM in the SDK, although this should be expanded a lot and include commands (I don’t see a single ICommand instance in Rhino SDK):
This file has been truncated.
public class CustomRenderSettingsViewModel : CollapsibleSectionViewModel, INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
private Rhino.Render.DataSources.RhinoSettings RenderSettingsForRead()
return GetData(Rhino.UI.Controls.DataSource.ProviderIds.RhinoSettings, false, true) as Rhino.Render.DataSources.RhinoSettings;
private Rhino.Render.DataSources.RhinoSettings RenderSettingsForWrite()
The Command class does exist in Eto and is not to be confused with the Rhino.Commands.Command:
You can see a command example here:
And for binding in xaml all i could find is this example:
Thank you Mathias.
I did some research and I am currently only partially using xeto, since some limits in XamlReader forces me to write C# code anyway in eto.
For someone having some WPF experience xeto looks like obvious choice, but is it not as bulletproof as simple C# code.
I agree. Im also still investigating whether to stick to xeto or not. The preview is nice, but…
Perhaps layouting in xeto and styling/binding etc in c#.
I also experienced errors in xeto that are difficult to debug with the xamlreader.