refactor: select clip editor via DataTemplates#188
Merged
Conversation
Avalonia 12 logs binding warnings on null-pivot path chains. The MainWindow editor region used IsVisible guards on SelectedClip.IsScriptClip, SelectedClip.IsTableClip, etc., which all bind through SelectedClip and spam warnings at startup before any clip is selected. Replace the three sibling editors with nested ContentControls keyed on ClipViewModel.Editor's runtime type. No editor instance exists when no clip is selected, so no binding chain resolves through null. Move the script editor's TextMate install and ScriptEditorController ownership into a ScriptTextEditor subclass so it self-installs from the DataTemplate. Override StyleKeyOverride to inherit TextEditor's control template — Avalonia 12 matches styles by exact type, and without it the subclass renders blank. Drop the corresponding wiring from MainWindow code-behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Avalonia 12 logs binding warnings on null-pivot path chains. The previous editor region used
IsVisiblebindings onSelectedClip.IsScriptClip,SelectedClip.IsTableClip, andSelectedClip.IsFallbackClip, which all resolve throughSelectedClipand produced six warnings at startup before any clip was selected.Selection is now driven by nested
ContentControls keyed onClipViewModel.Editor's runtime type viaDataTemplates. No editor instance exists when no clip is selected, so no binding chain resolves through null and the warnings are gone.The script editor lives in a new
ScriptTextEditor : TextEditorsubclass that owns itsTextMate.InstallationandScriptEditorControllerlifecycle and self-installs from itsDataTemplate.StyleKeyOverrideis set totypeof(TextEditor)because Avalonia 12 matches styles by exact type — without it the subclass renders blank. The fallback XML editor is inlined into itsDataTemplatesince it has no behavior beyond aDocumentbinding.Corresponding setup is dropped from
MainWindowcode-behind.Test plan
dotnet build SharpFM.slncleandotnet test SharpFM.sln— 1,155 passing