hc:ComboBox support for Validation
This commit is contained in:
1 parent
fcf3f9b72f
commit
4de0f713da
2 files changed
+18
-3
No files matched your search
@@ -357,9 +357,22 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IsError = !result.Data;
|
var isError = !result.Data;
|
||||||
ErrorStr = result.Message;
|
if (isError)
|
||||||
return result.Data;
|
{
|
||||||
|
SetCurrentValue(IsErrorProperty, true);
|
||||||
|
SetCurrentValue(ErrorStrProperty, result.Message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isError = Validation.GetHasError(this);
|
||||||
|
if (isError)
|
||||||
|
{
|
||||||
|
SetCurrentValue(ErrorStrProperty, Validation.GetErrors(this)[0].ErrorContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -556,6 +556,7 @@
|
|||||||
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}"/>
|
<Setter Property="Padding" Value="{StaticResource DefaultInputPadding}"/>
|
||||||
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
|
<Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsEditable" Value="true">
|
<Trigger Property="IsEditable" Value="true">
|
||||||
<Setter Property="IsTabStop" Value="false"/>
|
<Setter Property="IsTabStop" Value="false"/>
|
||||||
@@ -1375,6 +1376,7 @@
|
|||||||
|
|
||||||
<!--Handy式下拉框样式-->
|
<!--Handy式下拉框样式-->
|
||||||
<Style x:Key="ComboBoxPlusBaseStyle" BasedOn="{StaticResource ComboBoxExtendBaseStyle}" TargetType="hc:ComboBox">
|
<Style x:Key="ComboBoxPlusBaseStyle" BasedOn="{StaticResource ComboBoxExtendBaseStyle}" TargetType="hc:ComboBox">
|
||||||
|
<Setter Property="IsError" Value="{Binding Path=(Validation.HasError),RelativeSource={RelativeSource Self}}"/>
|
||||||
<Setter Property="Template" Value="{StaticResource ComboBoxPlusTopTemplate}"/>
|
<Setter Property="Template" Value="{StaticResource ComboBoxPlusTopTemplate}"/>
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<MultiTrigger>
|
<MultiTrigger>
|
||||||
|
|||||||
Reference in new issue
Block a user