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 8575207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:38:30+00:00 2026-06-11T19:38:30+00:00

I have a simple TextBox with the Style AutoCompleteTextBox: <TextBox Name=TextBox Style={StaticResource AutoCompleteTextBox} />

  • 0

I have a simple TextBox with the Style “AutoCompleteTextBox”:

<TextBox Name="TextBox" Style="{StaticResource AutoCompleteTextBox}" />

The Style is located in my Resource Dictionary:

<Style x:Key="AutoCompleteTextBox" TargetType="{x:Type TextBox}">
    <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
    <Setter Property="AllowDrop" Value="true" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type TextBox}">
                <Grid>
                    <Border x:Name="Bd" SnapsToDevicePixels="true">
                        <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                    <Popup x:Name="PART_Popup" StaysOpen="False" Placement="Bottom" IsOpen="False">
                        <ListBox x:Name="PART_ListBox" HorizontalContentAlignment="Stretch"/>
                    </Popup>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

In my Code Behind File I have two getters:

private Popup Popup
{
    get { return Template.FindName("PART_Popup", this) as Popup; }
}
private ListBox ItemList
{
    get { return Template.FindName("PART_ListBox", this) as ListBox; }
}

and the textbox load event:

void TextBox_Loaded(object sender, RoutedEventArgs e)
{
    var popup = Popup;

    var itemlist = ItemList;
}

Now I have the problem that Popup and ItemList returns always null, why?

  • 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-11T19:38:31+00:00Added an answer on June 11, 2026 at 7:38 pm

    In XAML you create a normal TextBox and style it, in code behind you have this.Template & this, how is that supposed to work? There is no way that this is actually the TextBox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say I have the below: <Style TargetType={x:Type TextBox}> <Setter Property=BorderThickness Value=1 /> <Setter
In my web application, I have users input a date in a simple textbox.
I have a simple MVC form with the following elements: <%= Html.TextBox(FechaInicio) %> Which
I have created a simple win 32 application..in which it has a textbox and
I'm having some trouble doing a very simple task. I have a rich textbox
I want to make a simple style for the textbox. I want to retain
I have a very simple silverlight xaml page displays textbox and a button. When
I have a simple user control with a TextBox . I want to change
I have written a simple MSN -style program that will send and retrieve messages
I have an asp.net page for a simple blog which looks like <asp:TextBox ID=txtContent

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.