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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:40:31+00:00 2026-05-25T09:40:31+00:00

What I’m looking to do is make a polygon visible if the textbox in

  • 0

What I’m looking to do is make a polygon visible if the textbox in the stackedpanel next to it has focus. Basically, it’ll be an indicator to which textbox has focus. This is going to be applied to multiple textboxes so I’d like to make it generic, using a style.

<StackPanel Visibility="{Binding showOpCode}" Margin="0,2" Orientation="Horizontal" >
            <TextBlock Width="212" VerticalAlignment="Center">Operation Code:</TextBlock>
            <Polygon Width="29" Points="14,8 14,21 28,14.5" Fill="Gray" Stroke="DarkGray"/>
            <TextBox HorizontalContentAlignment="Right" 
                     Name="txtOpCode" VerticalAlignment="Bottom" Width="122" Text="0"
                     Style="{StaticResource normalTextBoxStyle}" />
        </StackPanel>
  • 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-05-25T09:40:31+00:00Added an answer on May 25, 2026 at 9:40 am

    You would be better off building a custom TextBox style that includes the Polygon. You can get the default Styles from here.

    Just take the default Style for TextBox and related resources, then add your polygon to the left.

    Something like:

    <LinearGradientBrush x:Key="TextBoxBorder"
                         StartPoint="0,0"
                         EndPoint="0,20"
                         MappingMode="Absolute">
        <LinearGradientBrush.GradientStops>
            <GradientStop Color="#ABADB3"
                          Offset="0.05"/>
            <GradientStop Color="#E2E3EA"
                          Offset="0.07"/>
            <GradientStop Color="#E3E9EF"
                          Offset="1"/>
        </LinearGradientBrush.GradientStops>
    </LinearGradientBrush>
    
    <Style x:Key="CustomTextBoxStyle" TargetType="{x:Type TextBox}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background"
                Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush"
                Value="{StaticResource TextBoxBorder}"/>
        <Setter Property="BorderThickness"
                Value="1"/>
        <Setter Property="Padding"
                Value="1"/>
        <Setter Property="AllowDrop"
                Value="true"/>
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}"/>
        <Setter Property="ScrollViewer.PanningMode"
                Value="VerticalFirst"/>
        <Setter Property="Stylus.IsFlicksEnabled"
                Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <DockPanel>
                        <Polygon x:Name="polygon" DockPanel.Dock="Left" Width="29" Points="14,8 14,21 28,14.5" Fill="Gray" Stroke="DarkGray"/>
                        <theme:ListBoxChrome x:Name="Bd"
                                              BorderThickness="{TemplateBinding BorderThickness}"
                                              BorderBrush="{TemplateBinding BorderBrush}"
                                              Background="{TemplateBinding Background}"
                                              RenderMouseOver="{TemplateBinding IsMouseOver}"
                                              RenderFocused="{TemplateBinding IsKeyboardFocusWithin}"
                                              SnapsToDevicePixels="true">
                            <ScrollViewer x:Name="PART_ContentHost"
                                          SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </theme:ListBoxChrome>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocusWithin"
                                 Value="false">
                            <Setter TargetName="polygon"
                                    Property="Visibility"
                                    Value="Collapsed"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    

    Where the xmlns theme is defined as xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero". You’d need to add a ref to PresentationFramework.Aero.dll, or change it from a ListBoxChrome to a Border.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.