Idea: Create a general-purpose component that uses a generative AI model to dynamically generate or redesign XAML for templated controls, given a user-supplied text prompt. This could be used in any app that uses the MVVM architecture and could potentially be contributed to a larger community library.
Update: After further consideration, the plan is to focus on creating a custom Templated Control called GenerativeAiControl. This control will leverage the built-in Template property of the Control base class, allowing the AI to dynamically control the visual structure of the control.
How to Create a GenerativeAiControl:
The GenerativeAiControl is an abstract class that uses AI to create and modify templates for templated controls.
To limit prompt complexity, the dev specifies types that can be bound or declared in XAML via attributes in the backing code.
A source generator extracts documentation and type information, and supplies it to the AI model to help it understand the semantics of the types.
Set the Prompt property on your control. Keep it simple!
If an existing style template is set, it will be remixed using your prompt.
If no style template is set, the AI will generate a new one.
Future Considerations:
Once GenerativeAiControl is implemented and working well, it can serve as a stepping stone for more advanced features, such as allowing the AI to manipulate properties or call methods directly. This could be done by extending the GenerativeAiControl or by integrating it with other components or systems.
Giving an AI the ability to manipulate any arbitrary property can indeed be powerful, but it's most useful when it's part of a larger system or framework. This allows the AI's capabilities to be leveraged in a controlled and meaningful way.
Challenges:
The AI model would need to be capable of understanding the semantics of XAML and know how to write XAML that uses "pure" mvvm (converters, commands, inpc, no code behind).
Developing this feature would likely require a significant amount of effort and could potentially impact the app's performance.
Locally runnable language models are not yet up to the task.
Idea: Create a general-purpose component that uses a generative AI model to dynamically generate or redesign XAML for templated controls, given a user-supplied text prompt. This could be used in any app that uses the MVVM architecture and could potentially be contributed to a larger community library.
Update: After further consideration, the plan is to focus on creating a custom Templated Control called
GenerativeAiControl
. This control will leverage the built-in Template property of the Control base class, allowing the AI to dynamically control the visual structure of the control.How to Create a
GenerativeAiControl
:GenerativeAiControl
is an abstract class that uses AI to create and modify templates for templated controls.Prompt
property on your control. Keep it simple!Future Considerations:
GenerativeAiControl
is implemented and working well, it can serve as a stepping stone for more advanced features, such as allowing the AI to manipulate properties or call methods directly. This could be done by extending theGenerativeAiControl
or by integrating it with other components or systems.Challenges: