AXSG supports inline C# in valid XAML forms for scenarios where an expression or event block is clearer than introducing dedicated code-behind handlers or trivial view-model glue.
{CSharp Code=...}<CSharp Code="..." /><CSharp><![CDATA[ ... ]]></CSharp>These forms remain valid XAML and are understood by the compiler, runtime, and language service.
Inline C# can be used for:
Use inline C# when it improves local XAML readability. Do not use it as a substitute for domain logic or reusable behavior that should live in a view model or service.
Inline code is analyzed against the current XAML scope. Depending on location, that can include:
The same source-context model is reused by the language service, so compiler semantics and editor semantics stay aligned.
Use {CSharp Code=...} for short expressions or compact lambdas.
Code formUse <CSharp Code=\"...\" /> when you want object-element readability without introducing a multiline code block.
Use <CSharp><![CDATA[ ... ]]></CSharp> when:
Inline code participates in:
This includes navigation and references for context-aware members such as source, root, and event parameters when the underlying scope can be resolved.
Inline code is not a late string-eval escape hatch. AXSG lowers it into generated helpers or runtime-capable descriptors depending on the scenario. That is why helper identity, generated method shape, and context binding all matter for hot reload and Edit-and-Continue stability.
Prefer view-model or service code when: