User avatar
sfernandez
Site Admin
Posts: 2030
Joined: 22 Dec 2011, 19:20

Re: Microsoft Blend for Visual Studio and Unity workflow

10 Nov 2020, 17:42

One thing to pay attention to, though, is that the partial class in Unity (with the Noesis definitions) won't have access to the automatically generated elements, so you'll need to extract them yourself.
One way we recommend to do that is by having inside the code-behind code for NOESIS all the x:Named elements that you are going to use cached after the LoadComponent call:
public class MainView : UserControl
{
  public MainView()
  {
    InitializeComponent();
    this.AcceptButton.Click += this.OnAccept;
  }
  
#if NOESIS
  Button AcceptButton;
  private void InitializeComponent()
  {
    Noesis.GUI.LoadComponent(this, "Assets/UI/MainView.xaml");
    this.AcceptButton = (Button)FindName("AcceptButton");
  }
#endif

  private void OnAccept(object sender, RoutedEventArgs e)
  {
  }
}
This way you can share most of the C# code that works in Blend.

Tags:
 
User avatar
jsantos
Site Admin
Posts: 3002
Joined: 20 Jan 2012, 17:18
Contact:

Re: Microsoft Blend for Visual Studio and Unity workflow

10 Nov 2020, 19:28

Or using the generator available at

viewtopic.php?f=3&t=1930

We had plans to officially incorporate them into v3.0, but we didn't have enough time for that. It is coming in 3.1 "probably".

Who is online

Users browsing this forum: Google [Bot] and 2 guests