-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Feat: Add weeknumbers to Calendar #21311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 8 commits
27853b0
ccbe94a
b1de1ec
43c2fe9
64feeb4
4171178
4b51251
49d4f91
6c1866c
8ada34e
b1bca1e
73ebd42
68e9bda
40a12c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| namespace Avalonia.Controls.Primitives | ||
| { | ||
| /// <summary> | ||
| /// Displays a week number in the month view of a <see cref="Calendar"/>. | ||
| /// Apply styles targeting <see cref="CalendarWeekNumberLabel"/> to customise | ||
| /// the appearance — for example <c>FontWeight="Bold"</c>. | ||
| /// Use the <c>:header</c> pseudo-class to target the column header cell (row 0). | ||
| /// </summary> | ||
| public sealed class CalendarWeekNumberLabel : ContentControl | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO an entire new primitive probably isn't needed for this concept. It can be done with text and light-weight styling resources alone. That in turn allows room for future expansion in this area. For example -- we might want to make it interactive as a button in some way, the calendar might get a week ONLY view, etc. I'm also not a fan of the legacy term "Label" being used for new controls. That just isn't done in modern XAML. |
||
| { | ||
| private bool _isHeader; | ||
|
timunie marked this conversation as resolved.
Outdated
|
||
|
|
||
| /// <summary> | ||
| /// Gets or sets a value indicating whether this label is the column header cell | ||
| /// (placed in row 0 of the month grid, above the week-number data cells). | ||
| /// Themes can target this with the <c>:header</c> pseudo-class. | ||
| /// </summary> | ||
| public bool IsHeader | ||
| { | ||
| get => _isHeader; | ||
| internal set | ||
| { | ||
| if (_isHeader == value) return; | ||
| _isHeader = value; | ||
| PseudoClasses.Set(":header", value); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -402,6 +402,8 @@ | |
| <StaticResource x:Key="CalendarViewBorderBrush" ResourceKey="SystemControlForegroundChromeMediumBrush" /> | ||
| <StaticResource x:Key="CalendarViewWeekDayForegroundDisabled" | ||
| ResourceKey="SystemControlDisabledBaseMediumLowBrush" /> | ||
| <StaticResource x:Key="CalendarViewWeekNumberSeparatorForeground" | ||
| ResourceKey="SystemControlDisabledBaseMediumLowBrush" /> | ||
|
Comment on lines
+405
to
+406
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As mentioned above, if the |
||
| <StaticResource x:Key="CalendarViewNavigationButtonBackground" ResourceKey="SystemControlTransparentBrush" /> | ||
| <StaticResource x:Key="CalendarViewNavigationButtonForegroundPointerOver" | ||
| ResourceKey="SystemControlForegroundBaseHighBrush" /> | ||
|
|
@@ -1228,6 +1230,8 @@ | |
| <StaticResource x:Key="CalendarViewBorderBrush" ResourceKey="SystemControlForegroundChromeMediumBrush" /> | ||
| <StaticResource x:Key="CalendarViewWeekDayForegroundDisabled" | ||
| ResourceKey="SystemControlDisabledBaseMediumLowBrush" /> | ||
| <StaticResource x:Key="CalendarViewWeekNumberSeparatorForeground" | ||
| ResourceKey="SystemControlDisabledBaseMediumLowBrush" /> | ||
| <StaticResource x:Key="CalendarViewNavigationButtonBackground" ResourceKey="SystemControlTransparentBrush" /> | ||
| <StaticResource x:Key="CalendarViewNavigationButtonForegroundPointerOver" | ||
| ResourceKey="SystemControlForegroundBaseHighBrush" /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.