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

feat: Introducing Header and Placeholder #1014

Merged
merged 17 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 16 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
16 changes: 12 additions & 4 deletions doc/styles/TextBox.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ IsDefaultStyle\*: Styles in this column will be set as the default implicit styl
| `FilledTextBoxForegroundOpacityDisabled` | `Double` | `LowOpacity` |
| `FilledTextBoxPlaceholderForeground` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `FilledTextBoxPlaceholderForegroundPointerOver` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `FilledTextBoxPlaceholderForegroundFocused` | `SolidColorBrush` | `PrimaryBrush` |
| `FilledTextBoxPlaceholderForegroundFocused` | `SolidColorBrush` | `OnSurfaceBrush` |
| `FilledTextBoxPlaceholderForegroundDisabled` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `FilledTextBoxHeaderForeground` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `FilledTextBoxHeaderForegroundPointerOver` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `FilledTextBoxHeaderForegroundFocused` | `SolidColorBrush` | `PrimaryBrush` |
| `FilledTextBoxHeaderForegroundDisabled` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `OutlinedTextBoxBorderBrush` | `SolidColorBrush` | `OutlineBrush` |
| `OutlinedTextBoxBorderBrushPointerOver` | `SolidColorBrush` | `OnSurfaceBrush` |
| `OutlinedTextBoxBorderBrushFocused` | `SolidColorBrush` | `PrimaryBrush` |
Expand All @@ -55,8 +59,12 @@ IsDefaultStyle\*: Styles in this column will be set as the default implicit styl
| `OutlinedTextBoxForegroundOpacityDisabled` | `Double` | `LowOpacity` |
| `OutlinedTextBoxPlaceholderForeground` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `OutlinedTextBoxPlaceholderForegroundPointerOver` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `OutlinedTextBoxPlaceholderForegroundFocused` | `SolidColorBrush` | `PrimaryBrush` |
| `OutlinedTextBoxPlaceholderForegroundFocused` | `SolidColorBrush` | `OnSurfaceBrush` |
| `OutlinedTextBoxPlaceholderForegroundDisabled` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `OutlinedTextBoxHeaderForeground` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `OutlinedTextBoxHeaderForegroundPointerOver` | `SolidColorBrush` | `OnSurfaceVariantBrush` |
| `OutlinedTextBoxHeaderForegroundFocused` | `SolidColorBrush` | `PrimaryBrush` |
| `OutlinedTextBoxHeaderForegroundDisabled` | `SolidColorBrush` | `OnSurfaceLowBrush` |
| `OutlinedTextBoxFontFamily` | `FontFamily` | `BodyLargeFontFamily` |
| `OutlinedTextBoxFontWeight` | `String` | `BodyLargeFontWeight` |
| `OutlinedTextBoxFontSize` | `Double` | `BodyLargeFontSize` |
Expand All @@ -70,12 +78,12 @@ IsDefaultStyle\*: Styles in this column will be set as the default implicit styl
| `MaterialTextBoxClearGlyphWidth` | `Double` | 20 |
| `MaterialTextBoxClearGlyphHeight` | `Double` | 20 |
| `MaterialFilledTextBoxCornerRadius` | `CornerRadius` | 4,4,0,0 |
| `MaterialFilledTextBoxPadding` | `Thickness` | 16,7 |
| `MaterialFilledTextBoxPadding` | `Thickness` | 16,8 |
| `MaterialFilledTextBoxMinHeight` | `Double` | 58 |
| `MaterialFilledTextBoxBorderHeightFocused` | `Double` | 2 |
| `MaterialOutlinedTextBoxBorderThickness` | `Double` | 1 |
| `MaterialOutlinedTextBoxCornerRadius` | `CornerRadius` | 4 |
| `MaterialOutlinedTextBoxPadding` | `Thickness` | 16,7,14,7 |
| `MaterialOutlinedTextBoxPadding` | `Thickness` | 16,8 |
| `MaterialOutlinedTextBoxMinHeight` | `Double` | 56 |
| `MaterialOutlinedTextBoxBorderPadding` | `Thickness` | 1 |
| `MaterialOutlinedTextBoxBorderThicknessFocused` | `Double` | 2 |
30 changes: 15 additions & 15 deletions src/library/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<_Uno_XamlMerge_Task_Version>1.1.0-dev.12</_Uno_XamlMerge_Task_Version>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.1.1" />
<PackageVersion Include="Microsoft.Toolkit.Uwp.UI.Lottie" Version="6.1.0" />
<PackageVersion Include="Microsoft.UI.Xaml" Version="2.7.1" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.2.221109.1" />
<PackageVersion Include="Uno.Core.Extensions.Disposables" Version="4.0.1" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Extensions.Markup.Generators" Version="5.2.0-dev.61" />
<PackageVersion Include="Uno.Fonts.Roboto" Version="2.2.2" />
<PackageVersion Include="Uno.UI" Version="5.0.19" />
<PackageVersion Include="Uno.UI.Lottie" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Lottie" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Markup" Version="5.2.0-dev.61" />
<PackageVersion Include="Microsoft.UI.Xaml" Version="2.7.1" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.755" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.2.221109.1" />
<PackageVersion Include="Uno.Core.Extensions.Disposables" Version="4.0.1" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Extensions.Markup.Generators" Version="5.2.0-dev.61" />
<PackageVersion Include="Uno.Fonts.Roboto" Version="2.2.2" />
<PackageVersion Include="Uno.UI" Version="5.0.19" />
<PackageVersion Include="Uno.UI.Lottie" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Lottie" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Markup" Version="5.2.0-dev.61" />
<PackageVersion Include="Uno.XamlMerge.Task" Version="$(_Uno_XamlMerge_Task_Version)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Text;

#if WinUI
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
#else
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
#endif

namespace Uno.Material
{
public class FromTextBoxEmptyStringToValueConverter : IValueConverter
{
public object NoHeaderAndNoPlaceholderValue { get; set; }

public object HeaderOnlyValue { get; set; }

public object HeaderOnlyWithTextValue { get; set; }

public object PlaceholderOnlyValue { get; set; }

public object HeaderAndPlaceholderValue { get; set; }

public object Convert(object value, Type targetType, object parameter, string language)
{
var textBox = value as TextBox;

if (textBox is not null)
{
var noHeader = !(textBox.Header is string str1) || string.IsNullOrEmpty(str1);
var noPlaceholder = !(textBox.PlaceholderText is string str2) || string.IsNullOrEmpty(str2);
var noText = string.IsNullOrEmpty(textBox.Text);
Xiaoy312 marked this conversation as resolved.
Show resolved Hide resolved

if (!noHeader && !noPlaceholder)
{
return HeaderAndPlaceholderValue;
}
else if (!noHeader && noPlaceholder)
{
if (!noText)
{
return HeaderOnlyWithTextValue;
}

return HeaderOnlyValue;
}
else if (noHeader && !noPlaceholder)
{
return PlaceholderOnlyValue;
}

return NoHeaderAndNoPlaceholderValue;
}

return NoHeaderAndNoPlaceholderValue;
}

public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotSupportedException();
}
}
}
Loading
Loading