How to remove Calendar icon from DatePicker in maui for windows?

Jeff Pfahl 91 Reputation points
2022-06-16T22:08:53.44+00:00

Icon does not match our ui standard.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,177 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 38,756 Reputation points Microsoft Vendor
    2022-06-17T08:44:10.9+00:00

    Hello,

    In order to remove Calendar icon from DatePicker, you could copy default style for CalendarDatePicker from the path C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\Generic\generic.xaml into Your_MAUI_Project\Platforms\Windows\App.xaml, such as the following code:

       <maui:MauiWinUIApplication  
           ...>  
         
           <!--In this example, an implecit style for Calendar is defined elsewhere   
         in the application.  DatePickerCalendarStyle is based on the implicit   
         style so that the DatePicker will use the application's calendar style.-->  
           <maui:MauiWinUIApplication.Resources>  
               <!-- Default style for CalendarDatePicker --> from xaml file.  
           </maui:MauiWinUIApplication.Resources>  
         
       </maui:MauiWinUIApplication>  
    

    Then, you need to search the string Glyph="&#xE787;" and modify it to Glyph="".

    Restart your App, you could find the icon has been successfully removed.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments