Commit 709fb067 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 查找界面 机台号,工序号,可以输入 “空”

parent f3f027e6
......@@ -11,7 +11,7 @@
d:DesignHeight="450" d:DesignWidth="800"
Title="PageSelect">
<Page.Resources>
<local:IntNullValueConverter x:Key="intNullConv"/>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
......@@ -45,11 +45,11 @@
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TitleStyle}" Text="机台号"/>
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding MachineNo}"/>
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding MachineNo, Converter={StaticResource intNullConv}}"/>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource TitleStyle}" Text="工序号"/>
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding StepNo}"/>
<TextBox Style="{StaticResource ValueStyle}" Text="{Binding StepNo, Converter={StaticResource intNullConv}}"/>
</StackPanel>
<controls:ToggleSwitch Header="只查找超出标准工艺"
Margin="{StaticResource ControlMargin}"
......
......@@ -293,5 +293,37 @@ namespace WSDDBBrowser
}
}
public class IntNullValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return "";
else if (value is int)
{
return value.ToString();
}
else
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string)
{
if (string.IsNullOrEmpty((string)value))
{
return null;
}
else if (int.TryParse((string)value, out int v))
{
return v;
}
else {
return null;
}
}
return null;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment