Home > DeveloperSection > Forums > How to Target all Textbox's within a Groupbox on a Window – WPF
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    February-04-2014 5:51 AM

 WPF WPF 
Ratings:


 1 Reply(s)
 1268  View(s)
Rate this:

I am trying to setup a windows.resoruces style that targets all textbox's within all groupbox's (so it would not target textbox's that are not found within a groupbox)

I know I could use the x:key field, but was wondering if there was a way to target certain controls within controls for an entire window or application?



Pravesh Singh

Total Post:411

Points:2881
Posted on    February-04-2014 6:02 AM

Hi Ankita,

You could try a nested style for your TextBoxes in Style.Resources of GroupBox with Style.TargetType but without x:key.

<Style TargetType="GroupBox">

    <Style.Resources>

        <Style TargetType="TextBox">

            ...

        </Style>

    </Style.Resources>

</Style>


Don't want to miss updates? Please click the below button!

Follow MindStick