Skip to content

Conversation

Copy link

Copilot AI commented Nov 28, 2025

GitHub Issue (If applicable): #

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

Card and CardContentControl controls have no default styles defined. When used without explicitly specifying a style, the controls render with no visual appearance.

What is the new behavior?

Default styles are now applied automatically:

Base Uno.Toolkit.UI:

  • DefaultCardStyle in Controls/Card/Card.xaml
  • DefaultCardContentControlStyle in Controls/CardContentControl/CardContentControl.xaml

Material Library (v2):

  • MaterialDefaultCardStyle based on MaterialFilledCardStyle
  • MaterialDefaultCardContentControlStyle based on MaterialFilledCardContentControlStyle
  • Implicit styles added to _Common.xaml

Sample Pages:

  • Added FluentTemplate examples to CardSamplePage.xaml demonstrating the default Card style with various configurations (basic, with supporting text, with media, and disabled states)
  • Added FluentTemplate examples to CardContentControlSamplePage.xaml demonstrating the default CardContentControl style with custom content templates

Follows the same pattern as Divider, NavigationBar, and Chip controls.

Note: Redundant style aliases were removed from _Common.xaml as they already existed in the "Other resources aliases" section.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

Original prompt

This section details on the original issue you should resolve

<issue_title>Card and CardContentControl are missing default styles</issue_title>
<issue_description>The Card and CardContentControl controls are missing default styles in the Uno.Toolkit.WinUI project.

We have styles for them defined in the Uno.Toolkit.WinUI.Material, but again, none of those styles are being set as the default style for the control like we do for the rest of the Material styles/controls.

We need to define default styles in Material and in the base Uno.Toolkit.WinUI project</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: toolkit-bug-fix-bot
Identifies critical bugs in your project and implements targeted fixes with working code


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: kazo0 <4793020+kazo0@users.noreply.github.com>
@CLAassistant
Copy link

CLAassistant commented Nov 28, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ kazo0
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Add default styles for Card and CardContentControl Add default styles for Card and CardContentControl controls Nov 28, 2025
Copilot AI requested a review from kazo0 November 28, 2025 16:38
Comment on lines 19 to 20
<StaticResource x:Key="CardStyle" ResourceKey="MaterialFilledCardStyle" />
<StaticResource x:Key="CardContentControlStyle" ResourceKey="MaterialFilledCardContentControlStyle" />
Copy link
Contributor

@kazo0 kazo0 Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot these two lines aren't needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the redundant aliases in d5866b6. The CardStyle and CardContentControlStyle aliases already exist in the "Other resources aliases" section below.

@kazo0 kazo0 marked this pull request as ready for review December 2, 2025 00:34
Copilot AI review requested due to automatic review settings December 2, 2025 00:34
@kazo0 kazo0 enabled auto-merge (squash) December 2, 2025 00:35
Co-authored-by: kazo0 <4793020+kazo0@users.noreply.github.com>
auto-merge was automatically disabled December 2, 2025 00:36

Head branch was pushed to by a user without write access

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds missing default styles for the Card and CardContentControl controls, addressing the issue where these controls previously had no visual appearance when used without explicit styling.

Key Changes:

  • Created base default styles in Uno.Toolkit.UI for both controls
  • Added Material Design v2 default styles that inherit from the Material filled variants
  • Configured implicit style bindings and aliases in the Material library

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/library/Uno.Toolkit.Material/Styles/Controls/v2/_Common.xaml Adds implicit style bindings and aliases for Card and CardContentControl to Material theme
src/library/Uno.Toolkit.Material/Styles/Controls/v2/CardContentControl.xaml Defines MaterialDefaultCardContentControlStyle based on the filled variant
src/library/Uno.Toolkit.Material/Styles/Controls/v2/Card.xaml Defines MaterialDefaultCardStyle based on the filled variant
src/Uno.Toolkit.UI/Controls/CardContentControl/CardContentControl.xaml Creates new base default style and template with theme resources for CardContentControl
src/Uno.Toolkit.UI/Controls/Card/Card.xaml Creates new base default style and template with theme resources and content templates for Card

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +71 to +74
<Border x:Name="HoverPressed"
Background="{ThemeResource CardContentControlBorderBrushPressed}"
IsHitTestVisible="False"
Opacity="0" />
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HoverPressed border is defined but never used in any visual states. The Pressed visual state (lines 101-107) sets opacity on HoverOverlay and FocusedOverlay but doesn't reference HoverPressed, making this element unused and potentially confusing.

Suggested change
<Border x:Name="HoverPressed"
Background="{ThemeResource CardContentControlBorderBrushPressed}"
IsHitTestVisible="False"
Opacity="0" />

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HoverPressed border is actually used in the Pressed visual state on line 103 where it sets HoverPressed.Opacity to 1. The visual state correctly shows the pressed overlay when the control is pressed.

AutomationProperties.AccessibilityView="Raw"
Content="{TemplateBinding IconsContent}"
ContentTemplate="{TemplateBinding IconsContentTemplate}"
Visibility="{Binding IconsContentTemplate, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NullToCollapsedConverter}}" />
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The visibility is bound to IconsContentTemplate instead of IconsContent. This means the presenter will be visible even when there's no actual content, as long as the template is set. Should bind to IconsContent to match the pattern used by other content presenters (lines 125, 135, 145, 155).

Suggested change
Visibility="{Binding IconsContentTemplate, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource NullToCollapsedConverter}}" />
Visibility="{Binding IconsContent, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource EmptyOrNullToCollapsedConverter}}" />

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binding to IconsContentTemplate is intentional and matches the Material styles pattern. The Icons section is designed to only be visible when a template is explicitly provided (not when content is provided). This is consistent with how all the Material Card styles handle icons visibility (see MaterialOutlinedCardStyle, MaterialFilledCardStyle, MaterialElevatedCardStyle, etc.).

Copilot AI requested a review from kazo0 December 2, 2025 00:38
@kazo0
Copy link
Contributor

kazo0 commented Dec 2, 2025

@copilot I need you to add the FluentTemplate to both the CardSamplePage and the CardContentControlSamplePage and add examples of the Card and CardContentControl using the new default Styles you created in the main Uno.Toolkit.UI project

…h default styles

Co-authored-by: kazo0 <4793020+kazo0@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 2, 2025

@copilot I need you to add the FluentTemplate to both the CardSamplePage and the CardContentControlSamplePage and add examples of the Card and CardContentControl using the new default Styles you creat...

Added FluentTemplate sections to both CardSamplePage.xaml and CardContentControlSamplePage.xaml in f7edb38. The examples demonstrate the default styles (DefaultCardStyle and DefaultCardContentControlStyle) created in the base Uno.Toolkit.UI project with various configurations including media, supporting text, and disabled states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card and CardContentControl are missing default styles

3 participants