|
52 | 52 | ``` |
53 | 53 |
|
54 | 54 | Code that only writes to the `Blend` property (setter) is not affected by this change. |
| 55 | + |
| 56 | +### \[Breaking] BindableGue Deprecated - Binding Moved to GraphicalUiElement |
| 57 | + |
| 58 | +Previous versions of Gum provided binding support (data context, `SetBinding`, `BindingContext`) through a separate class called `BindableGue`, which sat between `GraphicalUiElement` and `InteractiveGue` in the inheritance hierarchy. This functionality has been moved directly into `GraphicalUiElement`, making binding available on all Gum runtime objects without requiring a specific base class. |
| 59 | + |
| 60 | +The `BindableGue` class still exists and compiles, but it is now marked `[Obsolete]` and is simply a subclass of `GraphicalUiElement` with no additional functionality. It will be removed in a future version. |
| 61 | + |
| 62 | +The following changes may be required depending on how your project uses `BindableGue`. |
| 63 | + |
| 64 | +#### How to Update |
| 65 | + |
| 66 | +Most projects will see compiler warnings on any code that references `BindableGue` by name. The fix in all cases is to replace `BindableGue` with `GraphicalUiElement`. |
| 67 | + |
| 68 | +**Custom classes that inherit BindableGue** |
| 69 | + |
| 70 | +If you have custom runtime classes that inherit from `BindableGue`, change the base class to `GraphicalUiElement`. |
| 71 | + |
| 72 | +❌ Old: |
| 73 | + |
| 74 | +```csharp |
| 75 | +public class MyCustomRuntime : BindableGue |
| 76 | +{ |
| 77 | + // ... |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +✅ New: |
| 82 | + |
| 83 | +```csharp |
| 84 | +public class MyCustomRuntime : GraphicalUiElement |
| 85 | +{ |
| 86 | + // ... |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +**Variables typed as BindableGue** |
| 91 | + |
| 92 | +If you store runtime references in variables typed as `BindableGue`, change the type to `GraphicalUiElement`. |
| 93 | + |
| 94 | +❌ Old: |
| 95 | + |
| 96 | +```csharp |
| 97 | +BindableGue currentScreen; |
| 98 | +``` |
| 99 | + |
| 100 | +✅ New: |
| 101 | + |
| 102 | +```csharp |
| 103 | +GraphicalUiElement currentScreen; |
| 104 | +``` |
| 105 | + |
| 106 | +**SkiaGum Children collection and related methods** |
| 107 | + |
| 108 | +The `Children` collection and child management methods on `GumSKElement` (SkiaGum WPF) and `SkiaGumCanvasView` (SkiaGum MAUI) previously used `BindableGue` as their element type. These now use `GraphicalUiElement`. |
| 109 | + |
| 110 | +❌ Old: |
| 111 | + |
| 112 | +```csharp |
| 113 | +ObservableCollection<BindableGue> children = myGumSKElement.Children; |
| 114 | +mySkiaCanvas.AddChild(myBindableGue); |
| 115 | +mySkiaCanvas.RemoveChild(myBindableGue); |
| 116 | +``` |
| 117 | + |
| 118 | +✅ New: |
| 119 | + |
| 120 | +```csharp |
| 121 | +ObservableCollection<GraphicalUiElement> children = myGumSKElement.Children; |
| 122 | +mySkiaCanvas.AddChild(myGraphicalUiElement); |
| 123 | +mySkiaCanvas.RemoveChild(myGraphicalUiElement); |
| 124 | +``` |
| 125 | + |
| 126 | +Since all existing `BindableGue` instances are also `GraphicalUiElement` instances, passing them to these methods continues to work without any casting. |
| 127 | + |
| 128 | +#### Codegen Output |
| 129 | + |
| 130 | +The Gum tool's code generation previously produced classes that inherit from `Gum.Wireframe.BindableGue`. Regenerating your runtime classes with the updated Gum tool will produce classes that inherit from `Gum.Wireframe.GraphicalUiElement` instead. |
| 131 | + |
| 132 | +❌ Old (generated): |
| 133 | + |
| 134 | +```csharp |
| 135 | +public partial class MyScreenRuntime : Gum.Wireframe.BindableGue |
| 136 | +``` |
| 137 | + |
| 138 | +✅ New (generated): |
| 139 | + |
| 140 | +```csharp |
| 141 | +public partial class MyScreenRuntime : Gum.Wireframe.GraphicalUiElement |
| 142 | +``` |
| 143 | + |
| 144 | +Existing generated files that still reference `Gum.Wireframe.BindableGue` will continue to compile during the deprecation period since `BindableGue` still exists. However, regenerating the files is recommended to avoid deprecation warnings and to prepare for the eventual removal of `BindableGue`. |
0 commit comments