Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7816953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:03:42+00:00 2026-06-02T06:03:42+00:00

I have a Style with a control template and I am having trouble getting

  • 0

I have a Style with a control template and I am having trouble getting it to compile. I am trying to trigger an attached behavior. If I put it in the control template triggers it works fine…but if I put it in the textbox triggers I get a build error that says:

Cannot find the static member ‘SelectAllProperty’ on the type
‘TextBoxBehavior’

Here is my code:

    <Style x:Key="RenamingTextBox" TargetType="{x:Type TextBox}">
                <Style.Setters>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type TextBox}">
                                <Grid>
                                    <TextBlock x:Name="block" Visibility="Visible" Text="{TemplateBinding Text}" Margin="0"/>
                                    <TextBox x:Name="box" Visibility="Collapsed" Text="{TemplateBinding Text}" Margin="0">
                                        <TextBox.Triggers>
                                            <Trigger Property="Visibility" Value="Visible">
                                                <Trigger.Setters>
                                                    <Setter TargetName="box" Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}"/>

<!-- This next line gives an error even though it is the same format as the one below -->
                                                    <Setter Property="behaviors:TextBoxBehavior.SelectAll" Value="True"/>
                                                </Trigger.Setters>                                            
                                            </Trigger>
                                        </TextBox.Triggers>
                                    </TextBox>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <DataTrigger Binding="{Binding IsRenaming}" Value="true">
                                        <DataTrigger.Setters>
                                            <Setter TargetName="block" Property="TextBox.Visibility" Value="Collapsed" />
                                            <Setter TargetName="box" Property="TextBox.Visibility" Value="Visible" />
<!-- Uncommenting below works fine -->
                                            <!--<Setter TargetName="box" Property="behaviors:TextBoxBehavior.SelectAll" Value="True"/>-->
                                        </DataTrigger.Setters>
                                    </DataTrigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style.Setters>
            </Style>

Any ideas as to why one gives a build error and the other doesn’t?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:03:45+00:00Added an answer on June 2, 2026 at 6:03 am

    Nevermind, I needed to put the triggers for the textbox in a style instead:

    <TextBox x:Name="box" Visibility="Collapsed" Text="{TemplateBinding Text}" Margin="0">
                                        <TextBox.Style>
                                            <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
                                                <Style.Triggers>
                                                    <Trigger Property="Visibility" Value="Visible">
                                                        <Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}"/>
                                                        <Setter Property="behaviors:TextBoxBehavior.SelectAll" Value="True"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have re-styled a textbox using a control template. The styling works well but
I have following user control: <UserControl.Resources> <Style TargetType=HeaderedItemsControl> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType=HeaderedItemsControl> <Grid>
I'm having a couple of major issues when trying to style the ChildWindow control
I've been trying to create my generic ReadOnlyCheckBox style/template but I'm having a problem
I have this style: <Style x:Key=SelectableListBoxItemStyle TargetType={x:Type ListBoxItem}> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType={x:Type ListBoxItem}>
I have a Button Style: <Style x:Key=ButtonStyle1 TargetType={x:Type Button}> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType={x:Type
So I have this WPF style: <Style x:Key=SmallLinkButton TargetType=Button> <Setter Property=Template> <Setter.Value> <ControlTemplate TargetType=Button>
I have problems with creating a simple Group-Box-Control via CreateWindowEx. The font-size/-style of its
I have a simple style for label controls. I'd like to define a control
I have a control template defined, call it myVal, that is used for validation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.