GameStudio: edit System.Guid properties in the property grid - #3280
Open
Nicogo1705 wants to merge 5 commits into
Open
GameStudio: edit System.Guid properties in the property grid#3280Nicogo1705 wants to merge 5 commits into
Nicogo1705 wants to merge 5 commits into
Conversation
Guid members on components/assets previously fell through to the read-only ObjectPropertyTemplateProvider fallback and rendered as a non-editable "Guid" row. Add a GuidPropertyTemplateProvider (TypeMatchTemplateProvider, also covers Nullable<Guid>) mirroring the string editor: a TextBox bound through a new GuidToString converter whose ConvertBack keeps the current value (Binding.DoNothing) when the text does not parse as a Guid. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow-up to the Guid property editor: ConvertBack now passes invalid text through instead of swallowing it with Binding.DoNothing — the typed node setter throws InvalidCastException, TextBoxBase raises TextToSourceValueConversionFailed, and the attached TextBoxPropertyValueValidationBehavior (same pattern as the UFile editor) plays the error adorner while the text reverts to the source value. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two usability layers on the Guid property editor: - GuidTemplateRemainder + a ghost TextBlock overlay: while the editor has focus, the typed prefix is completed with the remaining "0000...-0000" pattern in faint text, so the missing length and dash positions are visible at a glance. The typed part is rendered transparent purely to keep the remainder aligned. - GuidInputMaskBehavior: hex input is regrouped live as 8-4-4-4-12 with dashes inserted automatically (caret hops past a freshly inserted dash). Deletions are not fought — backspacing a dash does not re-append it — and non-hex input is left for commit-time validation to flag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mask behavior sets MaxLength = 36 (32 hex + 4 dashes) so typing past a complete Guid is rejected natively while selection replacement still works, and strips brace/paren wrappers from pasted Guid forms. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
While typing, any non-hex content turns the editor text IndianRed immediately (SetCurrentValue keeps styling intact; InvalidateProperty restores it once the text is clean). Purely visual - input is neither blocked nor rewritten, commit-time validation still does the hard reject. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
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.

PR Details
Guidmembers on components/assets previously fell through to the read-onlyObjectPropertyTemplateProviderfallback and rendered as a non-editable "Guid" row in theproperty grid — there was no way to set them from Game Studio at all.
This PR adds a proper Guid editor, plus a few usability layers on top:
Editing — a
GuidPropertyTemplateProvider(TypeMatchTemplateProvider, so it also coversNullable<Guid>) mirroring the string editor: aTextBoxbound through a newGuidToStringvalue converter. No registration code needed: providers declared in
DefaultPropertyTemplateProviders.xamlare auto-registered, and the defaultOverrideRule.Sometakes precedence over the read-only fallback.
Commit-time validation — invalid text is passed through by
ConvertBack, so thestrongly-typed node setter throws,
TextBoxBaseraisesTextToSourceValueConversionFailed, andthe attached
TextBoxPropertyValueValidationBehavior(same pattern as the UFile editor) playsthe red error adorner while the text reverts to the source value. The stored value can never be
corrupted.
Ghost template — while the editor has focus, the typed prefix is completed inline with the
remaining
0000…-0000pattern in faint text (via a newGuidTemplateRemainderconverter), sothe missing length and dash positions are visible at a glance.
Input mask (
GuidInputMaskBehavior) —a freshly inserted dash);
MaxLength), replacing a selection still works;{guid}/(guid)forms are unwrapped;rewritten — commit-time validation does the hard reject).
Before: a
[DataMember] public Guid MyIdproperty shows a non-editable row displaying "Guid".After: the value is editable as text with format guidance, auto-formatting and live feedback.
Related Issue
No linked issue — quality-of-life editor feature;
Guidproperties on user components werepreviously impossible to set from Game Studio.
Types of changes
Checklist