Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Textbox border curve

Textbox border curve

Scheduled Pinned Locked Moved WPF
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ravi Mori
    wrote on last edited by
    #1

    Hi,I want curve in all corners of textbox in wpf.. I got this by following code in dynamic resource. But from that i can't input anything in textbox. Any Suggessions? <Style x:Key="UserNameTextBox" TargetType="{x:Type TextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TextBoxBase}"> <Border Name="Border" Background="#FFEBE9E9" BorderBrush="#FF8B8787" BorderThickness="1" CornerRadius="3" Padding="3"/> </ControlTemplate> </Setter.Value> </Setter> </Style>

    A 1 Reply Last reply
    0
    • R Ravi Mori

      Hi,I want curve in all corners of textbox in wpf.. I got this by following code in dynamic resource. But from that i can't input anything in textbox. Any Suggessions? <Style x:Key="UserNameTextBox" TargetType="{x:Type TextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TextBoxBase}"> <Border Name="Border" Background="#FFEBE9E9" BorderBrush="#FF8B8787" BorderThickness="1" CornerRadius="3" Padding="3"/> </ControlTemplate> </Setter.Value> </Setter> </Style>

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      This should work,

      <Style x:Key="UserNameTextBox" TargetType="{x:Type TextBox}">
      <Setter Property="Template">
      <Setter.Value>
      <ControlTemplate TargetType="{x:Type TextBoxBase}">
      <Border Name="Border" Background="#FFEBE9E9" BorderBrush="#FF8B8787" BorderThickness="1" CornerRadius="3" Padding="3">
      <ScrollViewer x:Name="PART_ContentHost"/>
      </Border>
      </ControlTemplate>
      </Setter.Value>
      </Setter>
      </Style>

      R 1 Reply Last reply
      0
      • A ABitSmart

        This should work,

        <Style x:Key="UserNameTextBox" TargetType="{x:Type TextBox}">
        <Setter Property="Template">
        <Setter.Value>
        <ControlTemplate TargetType="{x:Type TextBoxBase}">
        <Border Name="Border" Background="#FFEBE9E9" BorderBrush="#FF8B8787" BorderThickness="1" CornerRadius="3" Padding="3">
        <ScrollViewer x:Name="PART_ContentHost"/>
        </Border>
        </ControlTemplate>
        </Setter.Value>
        </Setter>
        </Style>

        R Offline
        R Offline
        Ravi Mori
        wrote on last edited by
        #3

        Thanks a lot.. Can you please explain shortly about, <ScrollViewer x:Name="PART_ContentHost"/>

        A 1 Reply Last reply
        0
        • R Ravi Mori

          Thanks a lot.. Can you please explain shortly about, <ScrollViewer x:Name="PART_ContentHost"/>

          A Offline
          A Offline
          ABitSmart
          wrote on last edited by
          #4

          The ControlTemplate for a TextBox must contain exactly one element that is tagged as the content host element; this element will be used to render the contents of the TextBox. To tag an element as the content host, assign it the special name PART_ContentHost. The content host element must be either a ScrollViewer or an AdornerDecorator. The content host element may not host any child elements. From here, MSDN[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups