Studio 4.0 (Unity): no way to give design-time data to a DataTemplate edited from the Resources panel?
Posted: 03 Sep 2026, 04:21
Setup: NoesisGUI 4.0.0 Indie for Unity, Unity 6000.5.8f1, Studio opened inside Unity. The project file sits at the Unity project root, with DefaultDataNamespace set to "myapp", and the structures and data sets live in .noesis/data/structures and .noesis/data/sets.
Our screens are ControlTemplate resources in ResourceDictionaries. Their first child carries d:DataContext="JournalData", a Data Set of the structure myapp.Journal, which has a Lines collection of myapp.JournalLine. Opening such a screen in Studio works perfectly: the ItemsControl bound to Lines is filled, the rows are drawn with design data, and there are no errors.
Row templates are keyed DataTemplate resources used as ItemTemplate. For example, Journal.Line.Template is a Grid containing a few TextBlocks bound to Tick, Kind and Actor.
The problem is that opening such a DataTemplate from the Resources panel, in edit mode, gives it a string as DataContext. Every binding then logs two lines in the Unity console: "Binding failed: Path=Tick, Source=Boxed<String>(''), Target=TextBlock(''), TargetProperty=TextBlock.Text" and "Can't solve PropertyPath: Type 'Boxed<String>' does not contain a property named 'Tick'". With about fifteen row templates, this floods the console every time we browse the resources.
Here is what we tried, each result verified from the Unity Editor.log.
First, we put d:DataContext="JournalLineTest" on the template's root element, JournalLineTest being a Data Set of the structure myapp.JournalLine. Same errors. To see what the template actually receives, we added a TextBlock bound to the bare DataContext with a StringFormat of "ctx=[{0}]": it displays "ctx=[JournalLineTest]". So the attribute value is used as a literal string, not resolved to the Data Set. The same attribute on a screen's root is resolved correctly.
Second, we added DataType="myapp:JournalLine" on the DataTemplate. No change.
Third, we tried the Home icon in the Data panel, the one that assigns a Data Set to the current scope. It is greyed out when the DataTemplate is selected. If we move the row into a ControlTemplate resource, applied by a ContentControl inside the DataTemplate, and open that ControlTemplate, the Home icon becomes enabled: it writes exactly the same d:DataContext attribute on the root element and shows the blue badges, but the preview still receives the string.
Fourth, we tried a Data Set whose structure is not referenced as a collection SubType anywhere. Same result.
Fifth, we added FallbackValue to the bindings. The fallback is applied, but "Binding failed" is still logged.
So my questions are the following.
Is designing a DataTemplate with design-time data, outside of the page that hosts it, supported in Studio 4.0? Blend honors d:DataContext on the template root for exactly this case.
If it is not supported, what is the intended workflow, always editing item templates by opening the hosting screen and selecting a generated item?
And is there a way to avoid the binding-error flood in the Unity console when a template resource is opened without data?
Thanks.
Our screens are ControlTemplate resources in ResourceDictionaries. Their first child carries d:DataContext="JournalData", a Data Set of the structure myapp.Journal, which has a Lines collection of myapp.JournalLine. Opening such a screen in Studio works perfectly: the ItemsControl bound to Lines is filled, the rows are drawn with design data, and there are no errors.
Row templates are keyed DataTemplate resources used as ItemTemplate. For example, Journal.Line.Template is a Grid containing a few TextBlocks bound to Tick, Kind and Actor.
The problem is that opening such a DataTemplate from the Resources panel, in edit mode, gives it a string as DataContext. Every binding then logs two lines in the Unity console: "Binding failed: Path=Tick, Source=Boxed<String>(''), Target=TextBlock(''), TargetProperty=TextBlock.Text" and "Can't solve PropertyPath: Type 'Boxed<String>' does not contain a property named 'Tick'". With about fifteen row templates, this floods the console every time we browse the resources.
Here is what we tried, each result verified from the Unity Editor.log.
First, we put d:DataContext="JournalLineTest" on the template's root element, JournalLineTest being a Data Set of the structure myapp.JournalLine. Same errors. To see what the template actually receives, we added a TextBlock bound to the bare DataContext with a StringFormat of "ctx=[{0}]": it displays "ctx=[JournalLineTest]". So the attribute value is used as a literal string, not resolved to the Data Set. The same attribute on a screen's root is resolved correctly.
Second, we added DataType="myapp:JournalLine" on the DataTemplate. No change.
Third, we tried the Home icon in the Data panel, the one that assigns a Data Set to the current scope. It is greyed out when the DataTemplate is selected. If we move the row into a ControlTemplate resource, applied by a ContentControl inside the DataTemplate, and open that ControlTemplate, the Home icon becomes enabled: it writes exactly the same d:DataContext attribute on the root element and shows the blue badges, but the preview still receives the string.
Fourth, we tried a Data Set whose structure is not referenced as a collection SubType anywhere. Same result.
Fifth, we added FallbackValue to the bindings. The fallback is applied, but "Binding failed" is still logged.
So my questions are the following.
Is designing a DataTemplate with design-time data, outside of the page that hosts it, supported in Studio 4.0? Blend honors d:DataContext on the template root for exactly this case.
If it is not supported, what is the intended workflow, always editing item templates by opening the hosting screen and selecting a generated item?
And is there a way to avoid the binding-error flood in the Unity console when a template resource is opened without data?
Thanks.