日期:2014-05-16 浏览次数:20805 次
public class RangeRule : ValidationRule //验证规则类
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
return new ValidationResult(false, null);
}
}
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyControl">
<Style TargetType="{x:Type local:MyWindow}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MyWindow}">
<Border x:Name="windowFrame" BorderBrush="#395984" BorderThickness="1" Background="White">
<ContentPresenter/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
public class MyWindow : Window
{
static MyWindow()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MyWindow), new FrameworkPropertyMetadata(typeof(MyWindow)));
}
}
<xj:MyWindow x:Class="WPF3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xj="clr-namespace:MyControl;assembly=MyControl"
Title="MainWindow" Height="400" Width="605" MinHeight="600" MinWidth="828.8">
<Grid Width="943">
&