확인란의 기본 서식 파일을 약간 수정하면됩니다. 이제 처음부터 새 템플릿을 만드는 방법을 이해하지만이 사실을 알지 못합니다. 나는 (내가 생각하니?) here 메서드를 통해 기본 템플릿을 추출했습니다.기본 템플릿을 기반으로 컨트롤의 템플릿을 편집하는 방법이 있습니까?
그리고 밖으로 말다툼 :
<ControlTemplate TargetType="CheckBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna">
<BulletDecorator Background="#00FFFFFF" SnapsToDevicePixels="True">
<BulletDecorator.Bullet>
<mwt:BulletChrome Background="{TemplateBinding Panel.Background}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
BorderThickness="{TemplateBinding Border.BorderThickness}"
RenderMouseOver="{TemplateBinding UIElement.IsMouseOver}"
RenderPressed="{TemplateBinding ButtonBase.IsPressed}"
IsChecked="{TemplateBinding ToggleButton.IsChecked}" />
</BulletDecorator.Bullet>
<ContentPresenter RecognizesAccessKey="True"
Content="{TemplateBinding ContentControl.Content}"
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
Margin="{TemplateBinding Control.Padding}"
HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="ContentControl.HasContent">
<Setter Property="FrameworkElement.FocusVisualStyle">
<Setter.Value>
<Style TargetType="IFrameworkInputElement">
<Style.Resources>
<ResourceDictionary />
</Style.Resources>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Stroke="#FF000000"
StrokeThickness="1"
StrokeDashArray="1 2"
Margin="14,0,0,0"
SnapsToDevicePixels="True" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Control.Padding">
<Setter.Value>
<Thickness>2,0,0,0</Thickness>
</Setter.Value>
</Setter>
<Trigger.Value>
<s:Boolean>True</s:Boolean>
</Trigger.Value>
</Trigger>
<Trigger Property="UIElement.IsEnabled">
<Setter Property="TextElement.Foreground">
<Setter.Value>
<DynamicResource ResourceKey="{x:Static SystemColors.GrayTextBrushKey}" />
</Setter.Value>
</Setter>
<Trigger.Value>
<s:Boolean>False</s:Boolean>
</Trigger.Value>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
가 좋아, 확인, 같아요 잘 보인다. 나는 그것이 옳은지 아닌지를 알 수있는 충분한 경험이 없습니다. 이제 두 가지 오류가 발생합니다.
어셈블리 'PresentationFramework.Luna' 을 찾을 수 없습니다. 어셈블리 참조가 누락되어 있지 않은지 확인하십시오. 또한 프로젝트와 모든 참조 어셈블리가 빌드되었는지 확인하십시오.
유형
및
은 'MWT : BulletChrome'을 (를) 찾을 수 없습니다 했다. 어셈블리 참조가 누락되지 않았는지 확인하고 모든 참조 어셈블리가 작성되었는지 확인하십시오.
이제 실제로 템플릿 작업을 시작할 수 있도록 이러한 오류를 해결할 수 있습니까? 이것에 대해 갈 수있는 더 좋은 방법이 있습니까? 사장님은 초록색이 아닌 붉은 색 사각형이있는 3 가지 상태의 체크 박스를 원합니다. 그는 답을 얻지 않습니다.
내 체크 박스를 "테마 밖"으로 사용하는 것이 좋습니다. 무엇보다 그 상자를 빨간색으로 바꾸고 싶습니다! –