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. WPF(add a message or text in the xmal elements like ellipse at run time in windows application. [modified]

WPF(add a message or text in the xmal elements like ellipse at run time in windows application. [modified]

Scheduled Pinned Locked Moved WPF
csharpwpftutorialquestion
13 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.
  • C Ch Gayatri Subudhi

    Sir, Thanks for your concern. i need the text like textbox while in rumn time wt we want we are inserting,like this way i want to write some thing in the ellipse at run mode of the windows appliaction. Thanks and Regards Ch.Gaytari

    P Offline
    P Offline
    Philipp Sumi
    wrote on last edited by
    #4

    There's no problem doing that - you can change a label's content at runtime through a binding expression or code. It's a label, after all. even though it looks like an ellipse.

    NetDrives - Open Source Network Share Management

    C 1 Reply Last reply
    0
    • P Philipp Sumi

      There's no problem doing that - you can change a label's content at runtime through a binding expression or code. It's a label, after all. even though it looks like an ellipse.

      NetDrives - Open Source Network Share Management

      C Offline
      C Offline
      Ch Gayatri Subudhi
      wrote on last edited by
      #5

      Could you please give the sample code of this problem.Thanks in advance. With Regards Ch.Gayatri

      P 1 Reply Last reply
      0
      • C Ch Gayatri Subudhi

        Could you please give the sample code of this problem.Thanks in advance. With Regards Ch.Gayatri

        P Offline
        P Offline
        Philipp Sumi
        wrote on last edited by
        #6

        This is regular WPF 101 - just give the label in my sample a name like this:

        <Label x:Name="myLabel" ... />

        ...and in code, set the text:

        myLabel.Content = "this is easy";

        NetDrives - Open Source Network Share Management

        C 2 Replies Last reply
        0
        • P Philipp Sumi

          This is regular WPF 101 - just give the label in my sample a name like this:

          <Label x:Name="myLabel" ... />

          ...and in code, set the text:

          myLabel.Content = "this is easy";

          NetDrives - Open Source Network Share Management

          C Offline
          C Offline
          Ch Gayatri Subudhi
          wrote on last edited by
          #7

          let the windows form having text box ok..whn its in run mode we are able to enter some value in it like this way i need to write some thing like text or message in the ellipse of the xmal elements.Or any other way to solve this solution .Please suggest me. Thanks Ch.Gayatri

          P 1 Reply Last reply
          0
          • C Ch Gayatri Subudhi

            let the windows form having text box ok..whn its in run mode we are able to enter some value in it like this way i need to write some thing like text or message in the ellipse of the xmal elements.Or any other way to solve this solution .Please suggest me. Thanks Ch.Gayatri

            P Offline
            P Offline
            Philipp Sumi
            wrote on last edited by
            #8

            If you want to enter text, you need to style another control, e.g. textbox:

            <Grid>

            <Grid.Resources>

            <Style x:Key="EllipseLabel" TargetType="{x:Type TextBox}">
            
              <Setter Property="Template">
                <Setter.Value>
                  <ControlTemplate TargetType="{x:Type TextBox}">
                    <Grid >
                      <Ellipse  Width="{TemplateBinding Width}"
                                Height="{TemplateBinding Height}"
                                Stroke="LightPink"
                                StrokeThickness="05"
                                Fill="blue" />
                      <ScrollViewer HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" x:Name="PART\_ContentHost"/>
                    </Grid>
                  </ControlTemplate>
                </Setter.Value>
              </Setter>
            
            </Style>   
            

            </Grid.Resources>

            <TextBox Width="200" Height="100" Style="{StaticResource EllipseLabel}" Text="hello world" />
            

            </Grid>

            NetDrives - Open Source Network Share Management

            C 3 Replies Last reply
            0
            • P Philipp Sumi

              If you want to enter text, you need to style another control, e.g. textbox:

              <Grid>

              <Grid.Resources>

              <Style x:Key="EllipseLabel" TargetType="{x:Type TextBox}">
              
                <Setter Property="Template">
                  <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TextBox}">
                      <Grid >
                        <Ellipse  Width="{TemplateBinding Width}"
                                  Height="{TemplateBinding Height}"
                                  Stroke="LightPink"
                                  StrokeThickness="05"
                                  Fill="blue" />
                        <ScrollViewer HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" x:Name="PART\_ContentHost"/>
                      </Grid>
                    </ControlTemplate>
                  </Setter.Value>
                </Setter>
              
              </Style>   
              

              </Grid.Resources>

              <TextBox Width="200" Height="100" Style="{StaticResource EllipseLabel}" Text="hello world" />
              

              </Grid>

              NetDrives - Open Source Network Share Management

              C Offline
              C Offline
              Ch Gayatri Subudhi
              wrote on last edited by
              #9
              C 1 Reply Last reply
              0
              • C Ch Gayatri Subudhi
                C Offline
                C Offline
                Ch Gayatri Subudhi
                wrote on last edited by
                #10

                inside canvas also i can apply the given code in all these xmal elemts like ellipse,rectangular,square a.d so on..

                1 Reply Last reply
                0
                • P Philipp Sumi

                  If you want to enter text, you need to style another control, e.g. textbox:

                  <Grid>

                  <Grid.Resources>

                  <Style x:Key="EllipseLabel" TargetType="{x:Type TextBox}">
                  
                    <Setter Property="Template">
                      <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TextBox}">
                          <Grid >
                            <Ellipse  Width="{TemplateBinding Width}"
                                      Height="{TemplateBinding Height}"
                                      Stroke="LightPink"
                                      StrokeThickness="05"
                                      Fill="blue" />
                            <ScrollViewer HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" x:Name="PART\_ContentHost"/>
                          </Grid>
                        </ControlTemplate>
                      </Setter.Value>
                    </Setter>
                  
                  </Style>   
                  

                  </Grid.Resources>

                  <TextBox Width="200" Height="100" Style="{StaticResource EllipseLabel}" Text="hello world" />
                  

                  </Grid>

                  NetDrives - Open Source Network Share Management

                  C Offline
                  C Offline
                  Ch Gayatri Subudhi
                  wrote on last edited by
                  #11

                  Thanks sir.

                  1 Reply Last reply
                  0
                  • P Philipp Sumi

                    This is regular WPF 101 - just give the label in my sample a name like this:

                    <Label x:Name="myLabel" ... />

                    ...and in code, set the text:

                    myLabel.Content = "this is easy";

                    NetDrives - Open Source Network Share Management

                    C Offline
                    C Offline
                    Ch Gayatri Subudhi
                    wrote on last edited by
                    #12

                    sir can i apply that code under canvas..

                    1 Reply Last reply
                    0
                    • P Philipp Sumi

                      If you want to enter text, you need to style another control, e.g. textbox:

                      <Grid>

                      <Grid.Resources>

                      <Style x:Key="EllipseLabel" TargetType="{x:Type TextBox}">
                      
                        <Setter Property="Template">
                          <Setter.Value>
                            <ControlTemplate TargetType="{x:Type TextBox}">
                              <Grid >
                                <Ellipse  Width="{TemplateBinding Width}"
                                          Height="{TemplateBinding Height}"
                                          Stroke="LightPink"
                                          StrokeThickness="05"
                                          Fill="blue" />
                                <ScrollViewer HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" x:Name="PART\_ContentHost"/>
                              </Grid>
                            </ControlTemplate>
                          </Setter.Value>
                        </Setter>
                      
                      </Style>   
                      

                      </Grid.Resources>

                      <TextBox Width="200" Height="100" Style="{StaticResource EllipseLabel}" Text="hello world" />
                      

                      </Grid>

                      NetDrives - Open Source Network Share Management

                      C Offline
                      C Offline
                      Ch Gayatri Subudhi
                      wrote on last edited by
                      #13

                      <pre></pre><Ellipse x:Name="C2" Height="353" Width="440" Stroke="LightPink" StrokeThickness="05" Visibility="Hidden" Fill="blue" Canvas.Top="63" Canvas.Left="80" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" ></Ellipse> <TextBox Name="TB5" Visibility="visible" Background="Transparent" Height="121" Width="218" Canvas.Top="179" Canvas.Left="223"></TextBox> ike this way also at run time we can write text,,is any mutiline set to true is any property is ther for texbox in WPF Thanks and Regards CH.Gayatri

                      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