-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AttachedCardShadow samples to Media Samples
Moves AttachedCardShadow doc to the Media Samples Move AttachedDropShadow samples to their own folder
- Loading branch information
1 parent
2428107
commit 3217d31
Showing
14 changed files
with
117 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...amples/AttachedDropShadowBasicSample.xaml → ...hadows/AttachedDropShadowBasicSample.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...les/AttachedDropShadowResourceSample.xaml → ...ows/AttachedDropShadowResourceSample.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...amples/AttachedDropShadowStyleSample.xaml → ...hadows/AttachedDropShadowStyleSample.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
components/Media/samples/Shadows/AttachedCardShadowBasicSample.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Page x:Class="MediaExperiment.Samples.Shadows.AttachedCardShadowBasicSample" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:media="using:CommunityToolkit.WinUI.Media" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
mc:Ignorable="d"> | ||
|
||
<Page.Resources> | ||
<media:AttachedCardShadow x:Key="CommonShadow" | ||
Offset="4" /> | ||
|
||
<Style BasedOn="{StaticResource DefaultButtonStyle}" | ||
TargetType="Button"> | ||
<Setter Property="ui:Effects.Shadow" Value="{StaticResource CommonShadow}" /> | ||
<Setter Property="HorizontalAlignment" Value="Center" /> | ||
</Style> | ||
</Page.Resources> | ||
|
||
<StackPanel VerticalAlignment="Center" | ||
Spacing="32"> | ||
<Button Content="I Have a Shadow!" /> | ||
<Image Width="100" | ||
Height="100" | ||
ui:Effects.Shadow="{StaticResource CommonShadow}" | ||
Source="ms-appx:///Assets/OwlShadow.jpg" /> | ||
</StackPanel> | ||
</Page> |
16 changes: 16 additions & 0 deletions
16
components/Media/samples/Shadows/AttachedCardShadowBasicSample.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using CommunityToolkit.WinUI.Media; | ||
|
||
namespace MediaExperiment.Samples.Shadows; | ||
|
||
[ToolkitSample(id: nameof(AttachedCardShadowBasicSample), "Basic Attached Card Shadow", description: $"A sample for showing how to create an {nameof(AttachedCardShadow)} on an element.")] | ||
public sealed partial class AttachedCardShadowBasicSample : Page | ||
{ | ||
public AttachedCardShadowBasicSample() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
components/Media/samples/Shadows/AttachedCardShadowUntemplatedSample.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Page x:Class="MediaExperiment.Samples.Shadows.AttachedCardShadowUntemplatedSample" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:media="using:CommunityToolkit.WinUI.Media" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
mc:Ignorable="d"> | ||
|
||
<!-- | ||
If you want to apply a shadow directly in your visual tree to an untemplated element | ||
You need to at least have a layer of depth as seen in this next example. | ||
--> | ||
<Border Width="100" | ||
Height="100"> | ||
<Border BorderBrush="White" | ||
BorderThickness="1" | ||
CornerRadius="32"> | ||
<Border.Background> | ||
<ImageBrush ImageSource="ms-appx:///Assets/OwlShadow.jpg" /> | ||
</Border.Background> | ||
</Border> | ||
<!-- | ||
We need to put the Shadow on a parent element here as otherwise the | ||
rounding of the border of the image above clips the shadow itself. | ||
This is easier to perform with the Composition only based shadow as the | ||
Shadow is projected to another element. | ||
--> | ||
<ui:Effects.Shadow> | ||
<media:AttachedCardShadow CornerRadius="32" | ||
Offset="4,4" /> | ||
</ui:Effects.Shadow> | ||
</Border> | ||
</Page> |
16 changes: 16 additions & 0 deletions
16
components/Media/samples/Shadows/AttachedCardShadowUntemplatedSample.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using CommunityToolkit.WinUI.Media; | ||
|
||
namespace MediaExperiment.Samples.Shadows; | ||
|
||
[ToolkitSample(id: nameof(AttachedCardShadowUntemplatedSample), "Untemplated Attached Card Shadow", description: $"A sample for showing how to create an {nameof(AttachedCardShadow)} on an untemplated element.")] | ||
public sealed partial class AttachedCardShadowUntemplatedSample : Page | ||
{ | ||
public AttachedCardShadowUntemplatedSample() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} |