I'm experimenting with creating my own components using Radzen Blazor Studio and then inserting them using RBS's 'Add Component' option.
Can you please clarify what exactly causes a file I create to appear in the list of Components? Is it that the file contains both markup and a @code block? I ask because initially I could not make my file appear, but then it seemsed to after I added a code block.
Also, if I create a Page to use as a component, is there a way to make it not use the MainLayout without doing what I've currently done, which is to create an empty alternative layout?
What file doesn't appear in the components toolbox? Can you provide more info? Where do you create the file, what contents? There isn't any imposed limitation for the presence of a @code{} block.
But when I tried to insert this into another Page, it wasn't listed under Components. I add an @Code block and then it seemed to appear, although I've just checked again and it isn't appearing now...
Pages should not be used in other pages. Shared components should be defined outside of the Pages directory - in the Components directory if using .NET 8.
So, I had not understood that the Layout switch suppresses the rendering of a layout when running as well as in design mode, so that one's cleared up thanks.
I have reworked my component - removed the @Page directive and put it into the Components folder etc - and that all seems to be fine, however in design mode I'm getting a render error as follows.
Thanks, I can see how that could help. What I've actually done is to move the data fetch into the main 'Page' component and pass it to the subcomponent as a parameter.
Incidentally, even if I set the Layout switch to off in the subcomponent, and save it, when I open the subcomponent again, the layout switch has come back on?