我將此樣式應用於infragistics
控件XamDateTimeEditor
。 按預期顯示新錯誤圖標。控制錯誤圖標在樣式化後顯示兩次
問題:發生驗證錯誤時,原始錯誤樣式仍顯示。從而使控件具有兩種錯誤圖標樣式。
<Style TargetType="{x:Type XamDateTimeEditor}">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Control}">
<DockPanel>
<Border
Background="Red"
Width="25"
Height="25"
CornerRadius="10"
>
<TextBlock
Text="Error"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontWeight="Bold"
Foreground="White"
/>
</Border>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
嘗試添加以下內容到風格:' ' –
@EdPlunkett它完全改變了控件的形狀。現在,我只得到沒有控制權的新供應商。 – John
我很驚訝你有任何控制權,因爲你正在用錯誤模板替換模板。如果在你的setter中你將Property改成'Property =「Validation.ErrorTemplate」',那麼將你的問題中的模板設置爲模板而不是'Template'? –