-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Description
When a Calendar's DisplayMode is set to "Year" in XAML and a DataContext is set, the control will be very wide at runtime. If no DataContext is set either in the ancestors or in the control, it works fine. If DisplayMode = "Month" in XAML (or not set), then there is also no problem when switching to "Year" view.
Reproduction Steps
Wrong look:
<Window x:Class="WpfCalendarYearViewIssue.MainWindow"
...
DataContext="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}">
<Grid>
<Calendar DisplayMode="Year"/>
</Grid>
</Window>
Wrong look:
<Window x:Class="WpfCalendarYearViewIssue.MainWindow"
...>
<Grid>
<Calendar DisplayMode="Year" DataContext="{Binding Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MainWindow}}}" DisplayDate="{Binding DateTimeValue}"/>
</Grid>
</Window>
Right look:
<Window x:Class="WpfCalendarYearViewIssue.MainWindow"
...>
<Grid>
<Calendar DisplayMode="Year"/>
</Grid>
</Window>
Expected behavior
Normal width as in Month view.
Actual behavior
The all instances of CalendarItemStyle's "CalendarItem.DayTitleTemplateResourceKey" element (day titles) display data source string representation (ToString()), but not visible because the DataTrigger hides it (Visibility = Hidden). Set visible to display the text on the screen.
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
No response
