Add VoiceAccessUserControl with mode display functionality for Translator/Recognizer modes #385
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a new
VoiceAccessUserControlthat displays the current mode (Translator/Recognizer) based on them_useTranslatorConfigflag value, providing clear visual feedback to users about which mode is currently active.Changes Made
New Files Added
C# Implementation:
Samples/Win7Samples/winui/speech/cs/voiceaccess/VoiceAccessUserControl.xaml- XAML layout with styled mode displaySamples/Win7Samples/winui/speech/cs/voiceaccess/VoiceAccessUserControl.xaml.cs- C# code-behind implementationVoiceAccessWindow.xaml,App.cs, project files, and test applicationC++ Implementation:
Samples/Win7Samples/winui/speech/cpp/voiceaccess/VoiceAccessUserControl.xaml- XAML layout for C++ versionSamples/Win7Samples/winui/speech/cpp/voiceaccess/VoiceAccessUserControl.cpp- C++/CLI implementationKey Features
Mode Display Area: Prominently styled TextBlock that shows:
m_useTranslatorConfigistruem_useTranslatorConfigisfalseProperty Implementation:
UseTranslatorConfigproperty controls the mode displayModeTextproperty exposes the current mode text to XAMLINotifyPropertyChangedfor proper data bindingUI Controls:
Professional Styling:
Code Example
Testing
m_useTranslatorConfigchangesImplementation Details
The control uses WPF data binding to automatically update the mode display when the configuration flag changes. The
UpdateModeText()method ensures the display stays synchronized with the internal state, and property change notifications enable proper MVVM patterns.Both C# and C++/CLI implementations are provided to support different development scenarios while maintaining the same XAML interface and functionality.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.