기본 스타일을 기반으로 스타일을 만드는 방법은 무엇입니까?
Silverlight에서 기본 스타일을 기반으로 스타일을 만드는 방법은 무엇입니까?
예를 들어 WPF에서는 다음과 같이 만듭니다.
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="2" />
</Style>
거의 똑같애. x:Type
더 명시적인 이름을 지정하여 빼기 만하면 됩니다.
<Style TargetType="TextBox" BasedOn="{StaticResource DefaultTextBoxStyle}">
자세한 내용은 여기 문서에 있습니다. 추신, 기본 템플릿이 필요한 경우 TextBox는 일반적으로 CoreStyles.xaml에서 찾을 수 있습니다.
답변을 처음 읽을 때 혼란 스러울 경우를 대비하여 주석에서 요청한 ADDENDUM;
" 기본 스타일이 필요합니다. 기본 스타일 은 ToolkitStyles.xaml과 같은 파일을 생성하는 기본적으로 제공되는 silverlight와 같은 애플리케이션 테마 (wpf / uwp 등에는 이러한 기능이 없음)에서 수행하기위한 것이므로 수행하기 매우 쉽습니다. , SDKStyles.xaml, CoreStyles.xaml 등 ... 답변의 정적 리소스 이름은 원래 답변 된 연도의 실버 라이트 버전을 대상으로 한 것입니다. "
기본 스타일을 기반으로 스타일을 만들려면 명명 된 스타일을 만든 다음 명명 된 스타일 ( http://weblogs.asp.net/lduveau/silverlight-how-to-inherit-from)을 기반으로 기본 스타일을 만들어야합니다 . -암시 적 스타일 )
<Style x:Key="DefaultCustomControlStyle" TargetType="local:CustomControl">
<Setter Property="Padding" Value="2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:CustomControl">
<ContentPresenter />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="local:CustomControl" BasedOn="{StaticResource DefaultCustomControlStyle}" />
내가 올바르게 이해하면 OverridesDefaultStyle을 찾고 있습니다.
<Style TargetType="{x:Type TextBox}">
<Setter Property="OverridesDefaultStyle" Value="False" />
<Setter Property="Margin" Value="2" />
<Setter Property="Padding" Value="2" />
</Style>
참고 URL : https://stackoverflow.com/questions/13016932/how-to-create-a-style-based-on-default-style
'IT Share you' 카테고리의 다른 글
사람들이 앱을 무료로 다운로드 할 수 있도록 프로모션 / 쿠폰 코드를 제공하는 방법이 있나요? (0) | 2020.11.18 |
---|---|
Xcode 4.2는 시뮬레이터를 중지 한 후 매번 main.m으로 점프합니다. (0) | 2020.11.18 |
인텔 컴파일러를 사용하는 Windows와 Linux의 성능 차이 : 어셈블리 살펴보기 (0) | 2020.11.18 |
git : 각 원격에 대해 다른 .gitignore 파일이 있습니다. (0) | 2020.11.18 |
오류가있을 때 LaTeX 컴파일을 수동으로 중단하지 마십시오. (0) | 2020.11.18 |