Skip to content
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

HeaderedControls #109

Merged
merged 13 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

13 changes: 0 additions & 13 deletions components/HeaderedContentControl/src/AdditionalAssemblyInfo.cs

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions components/HeaderedContentControl/src/Themes/Generic.xaml

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions components/HeaderedControls/samples/HeaderedContentControl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: HeaderedContentControl
author: skendrot
description: The HeaderedContentControl allows content to be displayed with a specified header.
keywords: HeaderedContentControl, Control, headered
dev_langs:
- csharp
category: Controls
subcategory: Layout
discussion-id: 0
issue-id: 0
icon: Assets/HeaderedContentControl.png
---

The `Header` property can be any object and you can use the `HeaderTemplate` to specify a custom look to the header. Content for the HeaderedContentControl will align to the top left. This is to maintain the same functionality as the ContentControl.

> [!NOTE]
> Setting the `Background`, `BorderBrush` and `BorderThickness` properties will not have any effect on the HeaderedContentControl. This is to maintain the same functionality as the ContentControl.

> [!Sample HeaderedContentControlSample]

> [!Sample HeaderedContentControlTextSample]

> [!Sample HeaderedContentControlImageSample]

> [!Sample HeaderedContentControlComplexSample]

## Syntax

```xaml
<Page ...
xmlns:controls="using:CommunityToolkit.WinUI.Controls"/>

<controls:HeaderedContentControl>
<!-- Header content or HeaderTemplate content -->
</controls:HeaderedContentControl>
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- 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. -->
<!-- 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. -->
<Page x:Class="HeaderedContentControlExperiment.Samples.HeaderedContentControlComplexSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- 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. -->
<!-- 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. -->
<Page x:Class="HeaderedContentControlExperiment.Samples.HeaderedContentControlImageSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras/3.0.23">
<PropertyGroup>
<ToolkitComponentName>HeaderedContentControl</ToolkitComponentName>
<ToolkitComponentName>HeaderedControls</ToolkitComponentName>
</PropertyGroup>

<!-- Sets this up as a toolkit component's sample project -->
Expand Down
30 changes: 30 additions & 0 deletions components/HeaderedControls/samples/HeaderedItemsControl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: HeaderedItemsControl
author: skendrot
description: The HeaderedItemsControl allows items to be displayed with a specified header.
keywords: HeaderedItemsControl, Control, Layout
dev_langs:
- csharp
category: Controls
subcategory: Layout
discussion-id: 0
issue-id: 0
icon: Assets/HeaderedItemsControl.png
---
The `Header` property can be any object and you can use the `HeaderTemplate` to specify a custom look to the header. Similiar objects can be set for the `Footer` and `FooterTemplate`.

> [!NOTE]
> Setting the `Background`, `BorderBrush` and `BorderThickness` properties will not have any effect on the HeaderedItemsControl. This is to maintain the same functionality as the ItemsControl.

> [!Sample HeaderedItemsControlSample]

## Syntax

```xaml
<Page ...
xmlns:controls="using:CommunityToolkit.WinUI.Controls"/>

<controls:HeaderedItemsControl>
<!-- Header content or HeaderTemplate content -->
</controls:HeaderedItemsControl>
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<controls:HeaderedItemsControl Header="Header 1"
<controls:HeaderedItemsControl Footer="Footer 1"
Header="Header 1"
ItemsSource="{x:Bind Items, Mode=OneWay}" />

<controls:HeaderedItemsControl Grid.Column="1"
Footer="Footer 2"
Header="Header 2"
ItemsSource="{x:Bind Items, Mode=OneWay}">
<controls:HeaderedItemsControl.HeaderTemplate>
Expand All @@ -25,6 +27,12 @@
Text="{Binding}" />
</DataTemplate>
</controls:HeaderedItemsControl.HeaderTemplate>
<controls:HeaderedItemsControl.FooterTemplate>
<DataTemplate>
<TextBlock FontWeight="SemiBold"
Text="{Binding}" />
</DataTemplate>
</controls:HeaderedItemsControl.FooterTemplate>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Expand Down
28 changes: 28 additions & 0 deletions components/HeaderedControls/samples/HeaderedTreeView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: HeaderedTreeView
author: michaelhawker
description: The HeaderedTreeView allows a treeview to be displayed with a specified header.
keywords: HeaderedTreeView, Control, Layout, treeview
dev_langs:
- csharp
category: Controls
subcategory: Layout
discussion-id: 0
issue-id: 0
icon: Assets/HeaderedTreeView.png
---
The `Header` property can be any object and you can use the `HeaderTemplate` to specify a custom look to the header. Similiar objects can be set for the `Footer` and `FooterTemplate`.


> [!Sample HeaderedTreeViewSample]

## Syntax

```xaml
<Page ...
xmlns:controls="using:CommunityToolkit.WinUI.Controls"/>

<controls:HeaderedTreeView>
<!-- Header content or HeaderTemplate content -->
</controls:HeaderedTreeView>
```
37 changes: 37 additions & 0 deletions components/HeaderedControls/samples/HeaderedTreeViewSample.xaml
niels9001 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!-- 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. -->
<Page x:Class="HeaderedItemsControlExperiment.Samples.HeaderedTreeViewSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:HeaderedItemsControlExperiment.Samples"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">

<Grid>
<controls:HeaderedTreeView Footer="Footer"
Header="Header"
ItemsSource="{x:Bind Items, Mode=OneWay}">
<controls:HeaderedTreeView.HeaderTemplate>
<DataTemplate>
<TextBlock FontWeight="SemiBold"
Text="{Binding}" />
</DataTemplate>
</controls:HeaderedTreeView.HeaderTemplate>
<controls:HeaderedTreeView.FooterTemplate>
<DataTemplate>
<TextBlock FontWeight="SemiBold"
Text="{Binding}" />
</DataTemplate>
</controls:HeaderedTreeView.FooterTemplate>
<controls:HeaderedTreeView.ItemTemplate>
<DataTemplate x:DataType="local:ExplorerItem">
<muxc:TreeViewItem Content="{x:Bind Name}"
IsExpanded="True"
ItemsSource="{x:Bind Children}" />
</DataTemplate>
</controls:HeaderedTreeView.ItemTemplate>
</controls:HeaderedTreeView>
</Grid>
</Page>
Loading
Loading