Skip to content

Commit d8fd39d

Browse files
committed
Add Card Sample
1 parent 544bc32 commit d8fd39d

6 files changed

Lines changed: 100 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ Install-Package DevWinUI
147147
## 🔥 DevWinUI.Controls 🔥
148148
### ⚡ What’s Inside? ⚡
149149

150+
- ✨ Card
150151
- ✨ StorageRing
151152
- ✨ StorageBar
152153
- ✨ WindowedContentDialog
@@ -296,6 +297,9 @@ Install-Package DevWinUI.ContextMenu
296297

297298
## 🕰️ History 🕰️
298299

300+
### Card
301+
![DevWinUI](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/Card.png)
302+
299303
### StorageBar
300304
![DevWinUI](https://raw.githubusercontent.com/ghost1372/DevWinUI-Resources/refs/heads/main/DevWinUI-Docs/StorageBar.gif)
301305

‎dev/DevWinUI.Controls/Themes/Generic.xaml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Themes\Styles\Controls\AnimatedImage.xaml
2828
Themes\Styles\Controls\ArcProgress.xaml
2929
Themes\Styles\Controls\BreadcrumbNavigator.xaml
3030
Themes\Styles\Controls\CalendarWithClockStyle.xaml
31+
Themes\Styles\Controls\Card.xaml
3132
Themes\Styles\Controls\Clock.xaml
3233
Themes\Styles\Controls\ClockRadioButton.xaml
3334
Themes\Styles\Controls\ColorfulShimmingEffect.xaml
@@ -829,6 +830,48 @@ Themes\Styles\Win2D\Watermark.xaml
829830
<Setter Property="FontWeight" Value="SemiBold" />
830831
<Setter Property="Foreground" Value="{ThemeResource TextFillColorTertiaryBrush}" />
831832
</Style>
833+
<Style x:Key="DefaultCardStyle" TargetType="local:Card">
834+
<Setter Property="Padding" Value="8" />
835+
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
836+
<Setter Property="VerticalContentAlignment" Value="Stretch" />
837+
<Setter Property="CornerRadius" Value="{ThemeResource OverlayCornerRadius}" />
838+
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
839+
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
840+
<Setter Property="BorderThickness" Value="1" />
841+
<Setter Property="Template">
842+
<Setter.Value>
843+
<ControlTemplate TargetType="local:Card">
844+
<Grid VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}">
845+
<Grid.RowDefinitions>
846+
<RowDefinition Height="Auto" MinHeight="44" />
847+
<RowDefinition Height="Auto" />
848+
<RowDefinition Height="*" />
849+
</Grid.RowDefinitions>
850+
<VisualStateManager.VisualStateGroups>
851+
<VisualStateGroup x:Name="TitleGridVisibilityStates">
852+
<VisualState x:Name="TitleGridVisible" />
853+
<VisualState x:Name="TitleGridCollapsed">
854+
<VisualState.Setters>
855+
<Setter Target="TitleGrid.Visibility" Value="Collapsed" />
856+
</VisualState.Setters>
857+
</VisualState>
858+
</VisualStateGroup>
859+
</VisualStateManager.VisualStateGroups>
860+
<Grid x:Name="TitleGrid">
861+
<Grid.ColumnDefinitions>
862+
<ColumnDefinition Width="*" />
863+
<ColumnDefinition Width="Auto" />
864+
</Grid.ColumnDefinitions>
865+
<TextBlock Margin="16,0,0,0" VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Text="{TemplateBinding Title}" />
866+
<ContentPresenter Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Content="{TemplateBinding TitleContent}" />
867+
</Grid>
868+
<Rectangle x:Name="Divider" Grid.Row="1" Height="1" HorizontalAlignment="Stretch" Fill="{ThemeResource DividerStrokeColorDefaultBrush}" Visibility="{TemplateBinding DividerVisibility}" />
869+
<ContentPresenter Grid.Row="2" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" />
870+
</Grid>
871+
</ControlTemplate>
872+
</Setter.Value>
873+
</Setter>
874+
</Style>
832875
<Style x:Key="DefaultClockStyle" TargetType="local:Clock">
833876
<Setter Property="BorderThickness" Value="1" />
834877
<Setter Property="Margin" Value="8,0" />
@@ -6203,6 +6246,7 @@ Themes\Styles\Win2D\Watermark.xaml
62036246
<TimePicker x:Name="PART_TimePicker" Grid.Column="1" Margin="{TemplateBinding TimePickerMargin}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
62046247
</Grid>
62056248
</ControlTemplate>
6249+
<Style BasedOn="{StaticResource DefaultCardStyle}" TargetType="local:Card" />
62066250
<Style BasedOn="{StaticResource DefaultClockStyle}" TargetType="local:Clock" />
62076251
<Style BasedOn="{StaticResource DefaultClockRadioButtonStyle}" TargetType="local:ClockRadioButton" />
62086252
<Style BasedOn="{StaticResource DefaultColorfulShimmingEffectStyle}" TargetType="local:ColorfulShimmingEffect" />

‎dev/DevWinUI.Gallery/Assets/NavViewMenu/AppData.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@
141141
"IsSpecialSection": false,
142142
"UseBuiltInNavigationViewInfoBadgeStyle": true,
143143
"Items": [
144+
{
145+
"UniqueId": "DevWinUIGallery.Views.CardPage",
146+
"Title": "Card",
147+
"Subtitle": "Card",
148+
"IsNew": true,
149+
"ImagePath": "ms-appx:///Assets/Fluent/RevealFocus.png"
150+
},
144151
{
145152
"UniqueId": "DevWinUIGallery.Views.StorageRingPage",
146153
"Title": "Storage Ring",

‎dev/DevWinUI.Gallery/T4Templates/NavigationPageMappings.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public partial class NavigationPageMappings
3232
{"DevWinUIGallery.Views.ThemeManagerPage", typeof(DevWinUIGallery.Views.ThemeManagerPage)},
3333
{"DevWinUIGallery.Views.CheckUpdatePage", typeof(DevWinUIGallery.Views.CheckUpdatePage)},
3434
{"DevWinUIGallery.Views.PickersPage", typeof(DevWinUIGallery.Views.PickersPage)},
35+
{"DevWinUIGallery.Views.CardPage", typeof(DevWinUIGallery.Views.CardPage)},
3536
{"DevWinUIGallery.Views.StorageRingPage", typeof(DevWinUIGallery.Views.StorageRingPage)},
3637
{"DevWinUIGallery.Views.StorageBarPage", typeof(DevWinUIGallery.Views.StorageBarPage)},
3738
{"DevWinUIGallery.Views.GifImagePage", typeof(DevWinUIGallery.Views.GifImagePage)},
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Page x:Class="DevWinUIGallery.Views.CardPage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:dev="using:DevWinUI"
7+
xmlns:local="using:DevWinUIGallery"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
mc:Ignorable="d">
10+
11+
<ScrollViewer>
12+
<StackPanel Margin="10"
13+
dev:PanelAttach.ChildrenTransitions="Default"
14+
Spacing="10">
15+
<local:ControlExample DocPage="controls/card"
16+
HeaderText="Card">
17+
<local:ControlExample.Xaml>
18+
<x:String>
19+
&lt;dev:Card Title="Title" /&gt;
20+
</x:String>
21+
</local:ControlExample.Xaml>
22+
<dev:Card Title="Title">
23+
<dev:Card.TitleContent>
24+
<Button Margin="0,0,10,0"
25+
Content="Title Content" />
26+
</dev:Card.TitleContent>
27+
<dev:Card.Content>
28+
<Button Content="Content" />
29+
</dev:Card.Content>
30+
</dev:Card>
31+
</local:ControlExample>
32+
</StackPanel>
33+
</ScrollViewer>
34+
35+
</Page>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace DevWinUIGallery.Views;
2+
3+
public sealed partial class CardPage : Page
4+
{
5+
public CardPage()
6+
{
7+
InitializeComponent();
8+
}
9+
}

0 commit comments

Comments
 (0)