From b6abd9f931ee4ce702de06c9c7fe33ffb9d576cc Mon Sep 17 00:00:00 2001 From: hovo-hakobyan <88614889+hovo-hakobyan@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:13:09 +0100 Subject: [PATCH 1/3] Textboxes have placeholder text instead of regular text --- .../Converter/TextToVisibilityConverter.cs | 20 +++++++++++++++++++ SquadForger/SquadForger.csproj | 5 ++++- SquadForger/View/SquadView.xaml | 18 +++++++++++++++-- SquadForger/ViewModel/SquadVM.cs | 3 +-- 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 SquadForger/Converter/TextToVisibilityConverter.cs diff --git a/SquadForger/Converter/TextToVisibilityConverter.cs b/SquadForger/Converter/TextToVisibilityConverter.cs new file mode 100644 index 0000000..6f0a79f --- /dev/null +++ b/SquadForger/Converter/TextToVisibilityConverter.cs @@ -0,0 +1,20 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace SquadForger.Converter +{ + public class TextToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return string.IsNullOrEmpty(value as string) ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/SquadForger/SquadForger.csproj b/SquadForger/SquadForger.csproj index c4c8b61..6d8e9d1 100644 --- a/SquadForger/SquadForger.csproj +++ b/SquadForger/SquadForger.csproj @@ -126,6 +126,7 @@ MSBuild:Compile Designer + @@ -197,7 +198,9 @@ - + + PreserveNewest + diff --git a/SquadForger/View/SquadView.xaml b/SquadForger/View/SquadView.xaml index adcb47d..90b1256 100644 --- a/SquadForger/View/SquadView.xaml +++ b/SquadForger/View/SquadView.xaml @@ -5,12 +5,16 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:SquadForger.View" xmlns:vm="clr-namespace:SquadForger.ViewModel" + xmlns:converter="clr-namespace:SquadForger.Converter" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Title="Squad View"> + + + @@ -25,7 +29,12 @@ - + + + + - + + + +