WPF(add a message or text in the xmal elements like ellipse at run time in windows application. [modified]
-
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
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
-
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
Could you please give the sample code of this problem.Thanks in advance. With Regards Ch.Gayatri
-
Could you please give the sample code of this problem.Thanks in advance. With Regards Ch.Gayatri
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
-
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
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
-
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
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
-
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
-
inside canvas also i can apply the given code in all these xmal elemts like ellipse,rectangular,square a.d so on..
-
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
Thanks sir.
-
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
sir can i apply that code under canvas..
-
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
<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