Creating a simple GUI element with XML?

In Classic as well as modern WoW, BasicFrameTemplate works to create a basic frame with a titlebar area and close button.

But in modern WoW, DefaultPanelTemplate will get you a frame similar in style to the rest of the default UI:

<Ui>
    <Frame name="SimpleFrame" parent="UIParent" inherits="DefaultPanelTemplate">
        <Size x="200" y="200"/>
        <Anchors>
            <Anchor point="CENTER"/>
        </Anchors>
        <Frames>
            <Button parentKey="CloseButton" inherits="UIPanelCloseButtonDefaultAnchors"/>        
        </Frames>
        <Scripts>
            <OnLoad>
                self.TitleContainer.TitleText:SetText("Simple Frame")
            </OnLoad>
        </Scripts>
    </Frame>
</Ui>

If you want an inset and button(s) across bottom:

<Ui>
    <Frame name="SimpleFrame" parent="UIParent" inherits="DefaultPanelTemplate">
        <Size x="150" y="150"/>
        <Anchors>
            <Anchor point="CENTER"/>
        </Anchors>
        <Frames>
            <Button parentKey="CloseButton" inherits="UIPanelCloseButtonDefaultAnchors"/>
			<Frame parentKey="Inset" useParentLevel="true" inherits="InsetFrameTemplate">
				<Anchors>
					<Anchor point="TOPLEFT" x="10" y="-26" />
					<Anchor point="BOTTOMRIGHT" x="-6" y="26" />
				</Anchors>
			</Frame>
            <Button parentKey="OkButton" inherits="UIPanelButtonTemplate" text="Okay">
                <Size x="90" y="22"/>
                <Anchors>
                    <Anchor point="BOTTOMRIGHT" x="-6" y="4"/>
                </Anchors>
                <Scripts>
                    <OnClick>
                        self:GetParent():Hide()
                    </OnClick>
                </Scripts>
            </Button>
        </Frames>
        <Scripts>
            <OnLoad>
                self.TitleContainer.TitleText:SetText("Simple Frame")
            </OnLoad>
        </Scripts>
    </Frame>
</Ui>

DefaultPanelTemplate has a TitleContainer area that contains the title fontstring, set as an example in the code above.

And DefaultPanelTemplate doesn’t include a close button like BasicFrameTemplate does/did, but if you add a button that inherits UIPanelCloseButtonDefaultAnchors it will behave as you’d expect.