I am under a situation where i need to develop DatePicker where the calendar must disappear on mouse leave event, only textbox with the selected date from calendar must be visible and calendar part must disappear, and calendar part must appear only on mouse enter of DatePicker so that the user will be able to select the date and immediately disappear as he selected and lost the focus.
I don't know visibility of which control of DatePicker has to be set to Visible or Hide. I tried several things from the DatePicker template which i found on the link given in resource part of my xaml, by setting the visibility to hidden or Visible but nothing worked. For example CalendarStyle below
<DatePicker x:Name="MyDatePicker" Margin="0,0,305,28"
CalendarStyle="{StaticResource CalendarName}">
</DatePicker>
Entire control style with my xaml code is here :
<Window x:Class="calendarHideTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<!--Here i kept the style of DatePicker written at link https://learn.microsoft.com/en-us/dotnet/framework/wpf/controls/calendar-styles-and-templates-->
</Window.Resources>
<StackPanel>
<DatePicker x:Name="MyDatePicker"
Margin="0,0,305,28"
CalendarStyle="{StaticResource CalendarName}">
</DatePicker>
</StackPanel>
</Window>
I want to know, Which subcontrol of datepicker i have to set to visibility "Hidden" to make the calendar part disappear ?