Click here to Skip to main content
15,899,935 members
Home / Discussions / WPF
   

WPF

 
QuestionDataBinding composite controls Pin
Adriaan Davel21-Jul-09 6:57
Adriaan Davel21-Jul-09 6:57 
AnswerRe: DataBinding composite controls Pin
Michael Sync23-Jul-09 6:36
Michael Sync23-Jul-09 6:36 
GeneralRe: DataBinding composite controls Pin
Adriaan Davel23-Jul-09 19:27
Adriaan Davel23-Jul-09 19:27 
GeneralRe: DataBinding composite controls Pin
Michael Sync23-Jul-09 20:05
Michael Sync23-Jul-09 20:05 
GeneralRe: DataBinding composite controls Pin
Adriaan Davel23-Jul-09 21:21
Adriaan Davel23-Jul-09 21:21 
GeneralRe: DataBinding composite controls Pin
Jeremy Likness26-Jul-09 3:08
professionalJeremy Likness26-Jul-09 3:08 
GeneralRe: DataBinding composite controls Pin
Adriaan Davel27-Jul-09 1:43
Adriaan Davel27-Jul-09 1:43 
QuestionGlobal Styles [modified] Pin
#realJSOP21-Jul-09 4:57
professional#realJSOP21-Jul-09 4:57 
I have the following defined in a (merged) resource dictionary:

<Style TargetType="{x:Type TextBox}">
    <Setter Property="BorderBrush" Value="Black" />
    <Setter Property="BorderThickness" Value="1" />
    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
    <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
    <Setter Property="Padding" Value="2"/>
    <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
    <Setter Property="AllowDrop" Value="true"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TextBox}">
                <Border x:Name="Bd"
                            CornerRadius="3"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                    <ScrollViewer x:Name="PART_ContentHost"/>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                    </Trigger>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="BorderBrush" TargetName="Bd" Value="Purple" />
                    </Trigger>
                    <Trigger Property="IsFocused" Value="True">
                        <Setter Property="BorderBrush" TargetName="Bd" Value="Purple" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>



If I add a TextBox control to a form, it does not use the global style. Why not?

If I put this style into the form's resources section it works. If I try to use it from it's original location in the resource dictionary, it doesn't.

EDIT ===========================

Why was this 1-voted?


"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


modified on Tuesday, July 21, 2009 2:33 PM

AnswerRe: Global Styles Pin
Pete O'Hanlon21-Jul-09 9:59
mvePete O'Hanlon21-Jul-09 9:59 
GeneralRe: Global Styles Pin
#realJSOP21-Jul-09 10:18
professional#realJSOP21-Jul-09 10:18 
GeneralRe: Global Styles Pin
Pete O'Hanlon21-Jul-09 10:24
mvePete O'Hanlon21-Jul-09 10:24 
GeneralRe: Global Styles Pin
#realJSOP21-Jul-09 10:52
professional#realJSOP21-Jul-09 10:52 
GeneralRe: Global Styles Pin
Pete O'Hanlon21-Jul-09 11:31
mvePete O'Hanlon21-Jul-09 11:31 
GeneralRe: Global Styles Pin
#realJSOP21-Jul-09 23:31
professional#realJSOP21-Jul-09 23:31 
GeneralRe: Global Styles Pin
Pete O'Hanlon22-Jul-09 0:22
mvePete O'Hanlon22-Jul-09 0:22 
GeneralRe: Global Styles Pin
#realJSOP22-Jul-09 2:21
professional#realJSOP22-Jul-09 2:21 
GeneralRe: Global Styles Pin
Pete O'Hanlon22-Jul-09 2:23
mvePete O'Hanlon22-Jul-09 2:23 
GeneralRe: Global Styles Pin
#realJSOP22-Jul-09 2:41
professional#realJSOP22-Jul-09 2:41 
GeneralRe: Global Styles Pin
Pete O'Hanlon22-Jul-09 3:43
mvePete O'Hanlon22-Jul-09 3:43 
QuestionSilverlight : Dynamic plugins? Pin
User 527145421-Jul-09 3:48
User 527145421-Jul-09 3:48 
AnswerRe: Silverlight : Dynamic plugins? Pin
Ray Cassick21-Jul-09 18:06
Ray Cassick21-Jul-09 18:06 
AnswerRe: Silverlight : Dynamic plugins? Pin
Michael Sync23-Jul-09 6:43
Michael Sync23-Jul-09 6:43 
Question3 Tangent Ciricles? Pin
jward21-Jul-09 0:55
jward21-Jul-09 0:55 
AnswerRe: 3 Tangent Ciricles? Pin
Michael Sync23-Jul-09 19:43
Michael Sync23-Jul-09 19:43 
QuestionWPF: Windows 7 Taskbar Integration throwing COM Exception Pin
Kunal Chowdhury «IN»21-Jul-09 0:26
professionalKunal Chowdhury «IN»21-Jul-09 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.