HOW TO TARGET ALL TEXTBOX'S WITHIN A GROUPBOX ON A WINDOW – WPF

Ankita Pandey

Total Post:183

Points:1285
Posted by  Ankita Pandey
WPF 
WPF
 1591  View(s)
Ratings:
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?

  1. Pravesh Singh

    Post:412

    Points:2888
    Re: How to Target all Textbox's within a Groupbox on a Window – WPF

    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>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!