-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: Microsoft Blend for Visual Studio and Unity workflow
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: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.
Code: Select all
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)
{
}
}
Re: Microsoft Blend for Visual Studio and Unity workflow
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".
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".
- Rocko Bonaparte
- Posts: 39
- Joined:
Re: Microsoft Blend for Visual Studio and Unity workflow
I'm trying to retrofit Movra's "Option C" to my project now that I've gotten comfortable:
Something more specific: My literal file hierarchy has:
/MainMenuResources.xaml
/Setup/SetupUserControl.xaml (this has a resource dictionary that sources ../MainMenuResources.xaml)
In the editor and also when I run, it can't find ../MainMenuResources.xaml. If I look in the build output, I see a flat file hierarchy:
/MainMenuResources.xaml
/SetupUserControl.xaml (../MainMenuResources.xaml would look in the wrong place)
When I had a separate Visual Studio project, the obj folder would preserve the file folders. I suspect there's something I need to do with the symlinks. I hope I don't have to create parallel folders in my Blend project (even if I can symlink the actual files) but it occurred to me as a workaround.
When I try to start a build of the application using Blend instead of Unity, it can't find paths for my resources. I'm assuming it's searching within its own project hierarchy. I symbolically linked in the files from Unity, which Blend then uses to produce output in its (in this case, BlendMyUnityProject) obj/Debug path. The directory structure is not preserved. So when I need to find something like "../MyResources.xaml" it's looking in the wrong place and can't resolve it.Create a new Unity project. Above the Assets folder start a new Blend project. Within the Assets folder put all your XAML stuff that belongs together in a single folder. Then create a symlink or junction from that folder to the Blend project folder.
MyUnityProject
-- Assets
---- MVVM
------- ViewModels
------- Views
-- BlendMyUnityProject
---- MVVM (= Symlink/Junction to Assets/MVVM folder)
Something more specific: My literal file hierarchy has:
/MainMenuResources.xaml
/Setup/SetupUserControl.xaml (this has a resource dictionary that sources ../MainMenuResources.xaml)
In the editor and also when I run, it can't find ../MainMenuResources.xaml. If I look in the build output, I see a flat file hierarchy:
/MainMenuResources.xaml
/SetupUserControl.xaml (../MainMenuResources.xaml would look in the wrong place)
When I had a separate Visual Studio project, the obj folder would preserve the file folders. I suspect there's something I need to do with the symlinks. I hope I don't have to create parallel folders in my Blend project (even if I can symlink the actual files) but it occurred to me as a workaround.
Re: Microsoft Blend for Visual Studio and Unity workflow
We no longer recommend using links because the way they work is different (broken?) in different versions of Blend. Everything is easier when your Blend project is located on top of Assets folder.
Who is online
Users browsing this forum: Bing [Bot] and 80 guests