Skip to content

Commit 4a263c4

Browse files
authored
[Presentation] Fix issue with binding quantum nodes when associated name is not found (#2195)
Note: the solution is rather hackish at the moment. To be revisited once we have an Avalonia version. Should we then introduce a service for setting/retrieving the Unset value
1 parent feea912 commit 4a263c4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

sources/editor/Stride.Core.Assets.Editor/Module.cs

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public static void Initialize()
1717
AssetsPlugin.RegisterPlugin(typeof(CoreAssetsEditorPlugin));
1818
// Initialize translation
1919
TranslationManager.Instance.RegisterProvider(new GettextTranslationProvider());
20+
// HACK
21+
Presentation.Quantum.ViewModels.NodeViewModel.UnsetValue = System.Windows.DependencyProperty.UnsetValue;
2022
}
2123
}
2224
}

sources/presentation/Stride.Core.Presentation.Quantum/ViewModels/NodeViewModel.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ internal class DifferentValuesObject { public readonly string Name = "DifferentV
4747

4848
public static readonly object DifferentValues = new DifferentValuesObject();
4949

50+
public static object UnsetValue;
51+
5052
static NodeViewModel()
5153
{
5254
typeof(NodeViewModel).GetProperties().Select(x => x.Name).ForEach(x => ReservedNames.Add(x));
@@ -317,7 +319,7 @@ public object GetAssociatedData(string name)
317319
public object GetDynamicObject(string name)
318320
{
319321
name = EscapeName(name);
320-
return GetChild(name) ?? GetCommand(name) ?? GetAssociatedData(name);
322+
return GetChild(name) ?? GetCommand(name) ?? GetAssociatedData(name) ?? UnsetValue;
321323
}
322324

323325
/// <inheritdoc/>

0 commit comments

Comments
 (0)