xxe 2 年之前
父節點
當前提交
bcb41ad599
共有 2 個檔案被更改,包括 29 行新增1 行删除
  1. +27
    -0
      HKCardOUT/Converter/TextForegroundConvert.cs
  2. +2
    -1
      HKCardOUT/Views/AdWindow.xaml

+ 27
- 0
HKCardOUT/Converter/TextForegroundConvert.cs 查看文件

@@ -23,6 +23,33 @@ namespace Converter
return default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class LocationConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString().Contains("6"))
return value.ToString().Replace("6", "1");
else if (value.ToString().Contains("5"))
return value.ToString().Replace("5", "2");
else if (value.ToString().Contains("4"))
return value.ToString().Replace("4", "3");
else if (value.ToString().Contains("3"))
return value.ToString().Replace("3", "4");
else if (value.ToString().Contains("2"))
return value.ToString().Replace("2", "5");
else if (value.ToString().Contains("1"))
return value.ToString().Replace("1", "6");
}
return default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();


+ 2
- 1
HKCardOUT/Views/AdWindow.xaml 查看文件

@@ -16,6 +16,7 @@
mc:Ignorable="d">
<Window.Resources>
<con:TextForegroundConvert x:Key="TextForegroundConvert" />
<con:LocationConvert x:Key="LocationConvert" />
<Style x:Key="Lbl" TargetType="TextBlock">
<Setter Property="FontSize" Value="26" />
<Setter Property="Margin" Value="0,5,0,10" />
@@ -69,7 +70,7 @@
HorizontalAlignment="Center"
Foreground="#ddd"
Style="{StaticResource Lbl}"
Text="{Binding LAdInfo.Gate}" />
Text="{Binding LAdInfo.Gate, Converter={StaticResource LocationConvert}}" />
</Grid>

<Grid Grid.Row="1" Margin="5">


Loading…
取消
儲存