Merge branch 'master' of http://scddns.f3322.net:13000/sc/Audit_APP
This commit is contained in:
commit
cc71b287d0
2 files changed
+27
-8
No files matched your search
@@ -7,18 +7,37 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace Audit.ConvertModels
|
||||
namespace Audit.ConvertMoels
|
||||
|
||||
{
|
||||
[ValueConversion(typeof(string), typeof(string))]
|
||||
internal class ColorSQLConvert : IValueConverter
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ColorSQLConvert : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
//int colorValue = (int)value;
|
||||
return "";
|
||||
if (value != null)
|
||||
{
|
||||
string colorValue = string.Format("{0:X6}", (int)value);//十进制RGB数值转十六进制六位RGB并补0位例“C0C0C0”
|
||||
//string StuffColor = "#FF" + colorValue;//RGB数值拼接为ARGB数值
|
||||
string StuffColor_B = colorValue.Substring(0, 2);//获取蓝色参数
|
||||
string StuffColor_G = colorValue.Substring(2, 2);//获取绿色参数
|
||||
string StuffColor_R = colorValue.Substring(4, 2);//获取红色参数
|
||||
string StuffColor = "#FF" + StuffColor_R + StuffColor_G + StuffColor_B;//RGB数值拼接为ARGB数值
|
||||
return StuffColor;//返回RGB数值例“#FFC0C0C0”
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return "";//返回白色RGB数值
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return "";
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Audit.View"
|
||||
xmlns:Convert="clr-namespace:Audit.ConvertModels"
|
||||
xmlns:Convert="clr-namespace:Audit.ConvertMoels"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
mc:Ignorable="d" DataContext="{Binding Source={StaticResource Locator},Path=Stuff}"
|
||||
d:DesignHeight="900" d:DesignWidth="1140"
|
||||
@@ -101,7 +101,7 @@
|
||||
<DataGridTemplateColumn Header="色彩" Width="100" MaxWidth="500" MinWidth="50" CanUserReorder="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Background="{Binding Path=Color,Converter={StaticResource ColorSQLConvert}}" Text="{Binding Color}" FontSize="15"/>
|
||||
<TextBlock Background="{Binding Path=Color,Converter={StaticResource ColorSQLConvert}}" Text="{Binding Color}" FontSize="15" Foreground="{x:Null}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
Reference in new issue
Block a user