मुख्य सामग्री पर जाएँ
Skillpedia
मोबाइल ऐप5.8k · #14589

maui-theming

यह क्या करती है

यह स्किल .NET MAUI ऐप्स में theming का मार्गदर्शन देती है, जिसमें light और dark mode और custom रंग themes शामिल हैं। यह उन डेवलपर के लिए है जो चाहते हैं कि ऐप system theme का पालन करे या उपयोगकर्ता चुन सके।

कब इस्तेमाल करें

  • ✓जब आप .NET MAUI ऐप को light और dark mode सपोर्ट कराना चाहें।
  • ✓जब आप runtime पर themes बदलना या उपयोगकर्ता को चुनने देना चाहें।
  • ✓जब आप resource dictionaries से ब्रांडेड रंग theme सेट करना चाहें।

Skill का लिंक

https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-theming/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/dotnet/skills/blob/main/plugins/dotnet-maui/skills/maui-theming/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे MAUI ऐप में dark mode जोड़िए और उपयोगकर्ता को settings में light, dark या system theme चुनने दीजिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट सरल light और dark रंगों के लिए theme bindings इस्तेमाल करता है, या custom themes के लिए resource dictionaries बदलता है, और system theme व उपयोगकर्ता की पसंद पर प्रतिक्रिया देता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

.NET MAUI Theming

Apply light/dark mode support, custom branded themes, and runtime theme switching in .NET MAUI apps using AppThemeBinding, ResourceDictionary swapping, and system theme detection APIs.

When to Use

  • Adding light and dark mode support to a .NET MAUI app
  • Creating custom branded themes with ResourceDictionary
  • Detecting and responding to system theme changes at runtime
  • Letting users choose a preferred theme (light, dark, or system default)
  • Combining OS-driven theme response with custom color palettes

When Not to Use

Inputs

  • A .NET MAUI project targeting .NET 8 or later
  • XAML pages or C# UI code that need theme-aware styling

Workflow

  1. Detect the current theme approach in the project (AppThemeBinding, ResourceDictionary, or none).
  2. Choose the appropriate strategy: AppThemeBinding for simple light/dark, ResourceDictionary swap for custom/multiple themes, or both combined.
  3. Define theme resources — inline AppThemeBinding values or separate ResourceDictionary files with matching keys.
  4. Replace hardcoded colors with DynamicResource bindings (or AppThemeBinding markup) throughout XAML pages.
  5. Add system theme detection via Application.Current.RequestedTheme and the RequestedThemeChanged event.
  6. Implement user preference persistence with Preferences.Set / Preferences.Get and apply on startup.
  7. Verify Android ConfigChanges.UiMode is set on MainActivity to avoid activity restarts on theme change.
  8. Test both light and dark themes on at least one target platform, confirming all UI elements respond correctly.

Rules That Change the Answer

Check these rules against the user's scenario, and apply only the ones that affect what they asked. UiMode and dictionary swapping matter for runtime theme switching; they are noise in a question about setting up AppThemeBinding.

Answer narrowly, but completely. Completeness means showing the code that implements what you recommended — not adding adjacent topics. If you recommend DynamicResource, show the dictionary swap that makes it update. If the user asks for light/dark colours in C#, show both SetAppThemeColor (colours) and the generic SetAppTheme<T> (any bindable property type), and prefer resource keys over scattered hardcoded colours. Do not tack on platform configuration the question didn't raise.

Rule Do this Not this Why
Runtime-swapped values must be dynamic {DynamicResource Key} {StaticResource Key} StaticResource resolves once at load and never updates when dictionaries are swapped.
Android must declare UiMode (only for runtime/system theme switching) Include ConfigChanges.UiMode in the ConfigurationChanges list on MainActivity Omitting it Without it Android restarts the activity on theme change — navigation state is lost and it looks like a crash. Irrelevant to a static AppThemeBinding setup
Force a theme via UserAppTheme Application.Current.UserAppTheme = AppTheme.Dark Manually re-assigning colors UserAppTheme overrides the OS; AppTheme.Unspecified returns to following the system.

Do not replace a working AppThemeBinding setup with ResourceDictionary swapping (or vice versa) unless the user needs what the other approach provides — more than two themes, or a user-selectable theme.

Choosing an Approach

Approach Best for Limitation
AppThemeBinding Automatic light/dark with OS — minimal code Only two themes (light + dark)
ResourceDictionary swap Custom branded themes, more than two themes, user preference More setup; must use DynamicResource everywhere
Both combined OS-driven response plus custom theme colors Most flexible but most complex

AppThemeBinding (OS Light/Dark)

AppThemeBinding selects a value based on the current system theme. It supports Light, Dark,

अक्सर पूछे जाने वाले सवाल

क्या यह system theme का पालन करती है?

हाँ। स्किल system theme और उपयोगकर्ता की अपनी पसंद दोनों पर प्रतिक्रिया कवर करती है।

क्या यह localization कवर करती है?

नहीं। भाषा बदलना अलग मार्गदर्शन में कवर होता है।

क्या यह app icons कवर करती है?

नहीं। app icons और splash screens इसके दायरे से बाहर हैं।

जानकारी

लेखक का मूल विवरण

Guide for theming .NET MAUI apps — light/dark mode via AppThemeBinding, ResourceDictionary theme switching, DynamicResource bindings, system theme detection, and user theme preferences. Use when: "dark mode", "light mode", "theming", "AppThemeBinding", "theme switching", "ResourceDictionary theme", "dynamic resources", "system theme detection", "color scheme", "app theme", "DynamicResource". Do not use for: localization or language switching (see .NET MAUI localization documentation), accessibility visual adjustments (see .NET MAUI accessibility documentation), app icons or splash screens (see

repo: dotnet/skills

लोकप्रियता

GitHub स्टार
5.8k
रैंकिंग में स्थान
#14589
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills