I have a ComboBox
where the ComboBoxItem
has a Grid
with a Calendar
inside.
The problem is that by clicking next to month label the drop down gets closed and the ComboBox changes as shown in the figure.
This happens only by clicking there. All the other behaviours are right.
I don't know which event creates this problem..any help is really appreciate!
This is the ComboBox
xaml definition:
<ComboBox Height="46" Width="180" Text="{mhira3D:TranslateMarkup Value1 = filteringComboBox}" Margin="0,0,8,0" IsEditable="False" Tag="../Assets/Icons/filter.svg"
IsReadOnly="True" Style="{DynamicResource OneItemOnlyComboBox}"
IsDropDownOpen="{Binding FilterConcluded}">
<ComboBox.IsEnabled>
<MultiBinding Converter="{StaticResource BooleanAndConverter}">
<Binding Path="ChartViewModel.NotDbErrorOccured" />
<Binding Path="ChartViewModel.AtLeastOneRoiSelected" />
</MultiBinding>
</ComboBox.IsEnabled>
<ComboBoxItem Style="{DynamicResource ComboBoxItemNoMouseOver}">
<Grid Width="490">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<...Definition of the buttons...>
<Viewbox Grid.Column="1" Grid.Row="0" Grid.RowSpan="4">
<Calendar Name="CalendarFilter" SelectionMode="SingleRange"
IsTodayHighlighted="True"
BorderBrush="{DynamicResource StandardBorderColor}" SelectedDatesChanged="Calendar_OnSelectedDatesChanged">
<Calendar.BlackoutDates>
<CalendarDateRange Start="{x:Static local:OverallChartWindow.Tomorrow}"
End="{x:Static sys:DateTime.MaxValue}" />
</Calendar.BlackoutDates>
</Calendar>
</Viewbox>
</Grid>
</ComboBoxItem>
</ComboBox>
And this is the ComboBoxItem
style:
<Style x:Key="ComboBoxItemNoMouseOver" TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border>
<Grid Background="{TemplateBinding Background}">
<Rectangle Fill="{DynamicResource StandardBackgroundColor}"
IsHitTestVisible="False"/>
<Rectangle x:Name="fillColor" Fill="{DynamicResource DisabledGray}"
IsHitTestVisible="False"
Opacity="0" Stroke="{DynamicResource StandardBorderColor}"
StrokeThickness="2" />
<ContentControl x:Name="contentControl"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding Foreground}" IsHitTestVisible="False">
<ContentPresenter x:Name="contentPresenter" />
</ContentControl>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>