{"record":{"id":"278d2839814c3a13","repo":"stride3d/stride","slug":"a-part-named-part-editabletextbox-must-be-present-in-the","errorCode":null,"errorMessage":"A part named 'PART_EditableTextBox' must be present in the ControlTemplate, and must be of type 'Stride.Core.Presentation.Controls.Input.TextBox'.","messagePattern":"A part named 'PART_EditableTextBox' must be present in the ControlTemplate, and must be of type 'Stride\\.Core\\.Presentation\\.Controls\\.Input\\.TextBox'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Wpf/Controls/FilteringComboBox.cs","lineNumber":240,"sourceCode":"            }\n        }\n\n        private static void OnIsFilteringChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)\n        {\n            var filteringComboBox = (FilteringComboBox)d;\n            if (filteringComboBox.ItemsSource != null)\n            {\n                filteringComboBox.UpdateCollectionView();\n            }\n        }\n\n        public override void OnApplyTemplate()\n        {\n            base.OnApplyTemplate();\n\n            editableTextBox = GetTemplateChild(\"PART_EditableTextBox\") as TextBox;\n            if (editableTextBox == null)\n                throw new InvalidOperationException(\"A part named 'PART_EditableTextBox' must be present in the ControlTemplate, and must be of type 'Stride.Core.Presentation.Controls.Input.TextBox'.\");\n\n            listBox = GetTemplateChild(\"PART_ListBox\") as ListBox;\n            if (listBox == null)\n                throw new InvalidOperationException(\"A part named 'PART_ListBox' must be present in the ControlTemplate, and must be of type 'ListBox'.\");\n\n            editableTextBox.TextChanged += EditableTextBoxTextChanged;\n            editableTextBox.PreviewKeyDown += EditableTextBoxPreviewKeyDown;\n            editableTextBox.Validating += EditableTextBoxValidating;\n            editableTextBox.Validated += EditableTextBoxValidated;\n            editableTextBox.Cancelled += EditableTextBoxCancelled;\n            editableTextBox.LostFocus += EditableTextBoxLostFocus;\n            listBox.MouseUp += ListBoxMouseUp;\n        }\n\n        protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)\n        {\n            base.OnGotKeyboardFocus(e);\n            if (OpenDropDownOnFocus && !listBoxClicking)","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Wpf/Controls/FilteringComboBox.cs#L222-L258","documentation":"FilteringComboBox.OnApplyTemplate fetches the mandatory template part 'PART_EditableTextBox' and requires it to be the library's Stride TextBox type, wiring text-change/key/event handlers onto it. A missing or wrong-type part makes the combo non-functional, so it throws InvalidOperationException. A second check for PART_ListBox follows.","triggerScenarios":"Applying a ControlTemplate for FilteringComboBox that omits the element named PART_EditableTextBox, names it differently, or uses a plain System.Windows.Controls.TextBox instead of Stride's Stride.Core.Presentation.Controls.Input.TextBox.","commonSituations":"Re-templating FilteringComboBox from scratch; copying the default template but dropping or retyping the editable textbox part; theme resources missing so the default template isn't applied.","solutions":["Include an element named PART_EditableTextBox of type Stride.Core.Presentation.Controls.Input.TextBox in the ControlTemplate.","Replace any System.Windows.Controls.TextBox used under that name with the Stride TextBox (it exposes TextChanged/Validating/Cancelled events).","Restore the default template from the Stride theme dictionary and re-apply customizations."],"exampleFix":"<!-- before -->\n<TextBox x:Name=\"PART_EditableTextBox\"/>\n<!-- after -->\n<presentation:TextBox x:Name=\"PART_EditableTextBox\"\n    xmlns:presentation=\"http://schemas.stride3d.net/xaml/presentation\"/>","handlingStrategy":"validation","validationCode":"var tb = combo.Template?.FindName(\"PART_EditableTextBox\", combo);\nif (tb is not Stride.Core.Presentation.Controls.Input.TextBox)\n    throw new InvalidOperationException(\"Template needs a Stride TextBox named PART_EditableTextBox.\");","typeGuard":"bool HasEditableTextBoxPart(FilteringComboBox combo) => combo.Template?.FindName(\"PART_EditableTextBox\", combo) is Stride.Core.Presentation.Controls.Input.TextBox;","tryCatchPattern":"try { combo.ApplyTemplate(); }\ncatch (InvalidOperationException ex) { log.Error(\"FilteringComboBox template missing parts\", ex); }","preventionTips":["Use Stride's TextBox (not System.Windows.Controls.TextBox) for the editable part.","Keep the exact part names PART_EditableTextBox and PART_ListBox.","Derive custom templates from the shipped theme template."],"tags":["wpf","control-template","template-parts"],"backgroundTag":"resource-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}