-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introducing Header and Placeholder (#1014)
Co-authored-by: agneszitte <[email protected]>
- Loading branch information
1 parent
8929074
commit 61510df
Showing
6 changed files
with
359 additions
and
121 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
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 |
---|---|---|
@@ -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> |
66 changes: 66 additions & 0 deletions
66
src/library/Uno.Material/Converters/FromTextBoxEmptyStringToValueConverter.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,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); | ||
|
||
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(); | ||
} | ||
} | ||
} |
Oops, something went wrong.