|
Thanks for the reply.
I want to know if i can use the ID of the control to directly access the properties.
example: if the the silverlight control Id is Xaml1 and one of the property is FolderName
can i use Xaml1.FolderName="value"?
Another thing i want to know how the control is getting called.
Please let me know if i can access the properties without using query string or InitParameters.
Thanks in advance.
|
|
|
|
|
|
Hi,
I have one problem: In code, I call a function which is provided by others and this function will pop out a dialog. The function return a object and it has long integer value. I think the value is a window handle. So how to convert this handle to a wpf window?
thanks,
eric
|
|
|
|
|
|
Hey guys
I need to append text to a WPF RichTextBox, but specific colors.
After much googling i put together the following method
private void AppendRtfText(string Text, Brush Color)
{
TextRange range = new TextRange(txtChat.Document.ContentEnd, txtChat.Document.ContentEnd);
range.Text = Text;
range.ApplyPropertyValue(TextElement.ForegroundProperty, Color);
}
Now this works just fine, but I need to be able to specify RGB values.
The TextElement.ForegroundProperty only accepts a Brush and as far as I can see I cant specify RGB for a brush like i would with the Color class.
Any ideas? Cause I'm running out
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
|
Worked like a charm, thanks
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Passion != Programming & you.Occupation == jobTitles.Programmer)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Hi..
I am new to this concept.How to add a message or text in the ellipse of xmal element at run time of windows application.Is in a xmal ellipse control we can put text box to write text? if yes how, if not please suggest me the other way if possible...
the code :
Ellipse x:Name="C2" Height="353" Width="440" Stroke="LightPink" StrokeThickness="05" Visibility="Hidden" Fill="blue" Canvas.Top="63" Canvas.Left="80">
modified on Tuesday, May 5, 2009 12:54 AM
|
|
|
|
|
You're looking at the problem from the wrong end: An ellipse does not have the opportunity to display text, but a Label can take whatever look you want through a control template
<Grid>
<Grid.Resources>
<Style x:Key="EllipseLabel" TargetType="{x:Type Label}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Label}">
<Grid >
<Ellipse Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Stroke="LightPink"
StrokeThickness="05"
Fill="blue" />
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Label Width="200" Height="100" Style="{StaticResource EllipseLabel}" Content="hello world" />
</Grid>
...accordingly, if you change your label's content, the text changes.
NetDrives - Open Source Network Share Management
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
<Window x:Class="SreenDeginer.Window1"<br />
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br />
Title="Window1" Height="530" Width="852"><br />
<Canvas Height="498" Width="787"><br />
<Button Canvas.Left="40" Canvas.Top="10" Background="LightPink" Height="47" Width="73" Click="Button_Click" /><br />
<br />
<Canvas Height="422" Width="628" x:Name="c2" Background="Black" Visibility="Collapsed" Canvas.Left=" 20" Canvas.Bottom="5" Canvas.Top="67"><br />
<Rectangle Height="422" Width="56" Fill="Beige"></Rectangle><br />
<Rectangle Height="33" Width="628" Fill="Pink" Canvas.Left="0" Canvas.Top="0"><br />
<br />
</Rectangle><br />
<TextBlock Text="X" Canvas.Left="607" Foreground="Black" x:Name="ClBtn" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown" Height="23" Width="21"></TextBlock><br />
<Ellipse x:Name="E1" Height="25" Width="39" Stroke="Black" Canvas.Left="09" Canvas.Bottom="324" Canvas.Top="40" Fill="LightPink" MouseLeftButtonDown="E1_MouseLeftButtonDown"><br />
</Ellipse><br />
<Ellipse x:Name="E2" Height="322" Width="523" Stroke="LightPink" StrokeThickness="05" Visibility="Hidden" Fill="Blue" Canvas.Top="63" Canvas.Left="80" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" ></Ellipse><br />
<Rectangle Name="MyRectangle" Stroke="Black" Width="39" Fill="LightPink" Canvas.Left="09" Canvas.Bottom="316" Height="17" MouseLeftButtonDown="R1_MouseLeftButtonDown"/><br />
<Rectangle Name="REC2" Height="258" Width="507" Visibility="Hidden" Stroke="LightPink" StrokeThickness="05" Fill="Blue" Canvas.Top="66" Canvas.Left="85" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" ></Rectangle><br />
<br />
<!--<Polygon x:Name="P1" Height="27" Width="39" Canvas.Left="09" Canvas.Bottom="600" Canvas.Top="125" Fill="LightPink" ></Polygon>--><br />
<br />
<Ellipse x:Name="C1" Height="25" Width="28" Stroke="Black" Canvas.Left="09" Canvas.Bottom="600" Canvas.Top="125" Fill="LightPink" MouseLeftButtonDown="C1_MouseLeftButtonDown" ></Ellipse><br />
<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><br />
<Rectangle Name="Square" Height="27" Width="39" Stroke="black" Canvas.Left=" 09" Canvas.Top="170" Fill="LightPink" MouseLeftButtonDown="SQ1_MouseLeftButtonDown"></Rectangle><br />
<Rectangle Name="SQ1" Height="290" Width="290" Stroke="LightPink" StrokeThickness="05" Visibility="Hidden" Fill="Blue" Canvas.Top="63" Canvas.Left="85" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" ></Rectangle><br />
<Polygon Name="T1" Points="70,70 40,1 1,70" Stroke="black" Fill="LightPink" Height="38" Width="57.9" Canvas.Top="215" Canvas.Right="580" MouseLeftButtonDown="T1_MouseLeftButtonDown" /><br />
<Polygon Name="T2" Points="500,252 252,03 25,250" Stroke="LightPink" StrokeThickness="05" Fill="Blue" Visibility="Hidden" Height="300" Width="530" Canvas.Top="63" Canvas.Left="85" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" /><br />
<Polygon Name="S1" Visibility="Hidden" Stroke="Blue" StrokeThickness="1.0" Points="176.5,50 189.2,155.003 286.485,113.5 201.9,177 286.485,240.5 189.2,198.997 176.5,304 163.8,198.997 66.5148,240.5 151.1,177 66.5148,113.5 163.8,155.003" Canvas.Top="63" Canvas.Left="85" Fill="Blue" Height="332" Width="375" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" /><br />
<Polygon<br />
Name ="mypolygon1"<br />
Stroke="LightPink" <br />
StrokeThickness="03" <br />
Points="176.5,70 189.2,155.003 286.485,113.5 201.9,177 286.485,240.5<br />
189.2,198.997 176.5,304 163.8,198.997 66.5148,240.5 151.1,177<br />
66.5148,113.5 163.8,155.003" Height="343" Width="356" Fill="Blue" Canvas.Top="63" Canvas.Left="85" Visibility="Hidden" MouseMove="M1_MouseMove" MouseLeftButtonDown="M2_MouseLeftButtonDown" MouseLeftButtonUp="M3_MouseLeftButtonDown" /><br />
<br />
<br />
<br />
</Canvas><br />
<br />
</Canvas><br />
</Window><br />
|
|
|
|
|
inside canvas also i can apply the given code in all these xmal elemts like ellipse,rectangular,square a.d so on..
|
|
|
|
|
|
<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
|
|
|
|
|
sir can i apply that code under canvas..
|
|
|
|
|
I give up, can't find any good information about this anywhere
I have a UserControl with 6 textboxes. I have a quite complex datastructure from where I want to fill these textboxes. The datastructure contains several sets of "String[6]" but I can't figure out how to bind it
public partial class MyAttBox : UserControl
{
public static DependencyProperty LowChRXProperty = DependencyProperty.Register("LowChRX", typeof(String), typeof(MyAttBox));
public String LowChRX
{
get { return (String)GetValue(LowChRXProperty); }
set { SetValue(LowChRXProperty, value); }
}
}
"main" XAML:
<AttBox:MyAttBox Header="GSM 850" x:Name="AttBox_GSM850" />
my data is stored like:
public class ABC
{
private Dictionary<String, List<String>> m_values = new Dictionary<String, List<String>>();
public Dictionary<String, List<String>> Values
{
get { return m_values; }
set { m_values = value; }
}
What I want to is to select a Key in my code and connect the Values to the texboxes in my UC. How?
|
|
|
|
|
I'm confused...
mikla521 wrote: The datastructure contains several sets of "String[6]" but I can't figure out how to bind it
Then why didn't you show these "sets of "String[6]""??
The 6 textboxes....you want to bind those by index to 6 strings in a collection, right?
And that collection of 6 strings - where is that? Is that the List<> in each dictionary entry?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok, will try refine myself here
public class CouplerDB
{
private Dictionary<String, Coupler> m_products;
....
}
public class Coupler
{
private Dictionary<String, Attenuation> m_attenuations
....
}
public class Attenuation
{
private Dictionary<Band, List<String>> m_values = new Dictionary<Band, List<String>>();
I want my user control textboxes to display the values from the List<String>
but it's not absolute necessary to have that list, just a place to store 6 different value.
Scenario: In a listbox I can select a product. Radiobuttons to select Coupler. Then I have a UserControl for each Band which I want to display the corresponding Strings. Clear?
*Sigh*
If I change Coupler I need to change the binding.
Another way to do it is to hardcode everything, but then I need almost 60 UserControls with a total of 360 Textboxes! My way I "only" need maximum 10 UserControls...
|
|
|
|
|
mikla521 wrote: Clear?
No.
mikla521 wrote: Radiobuttons to select Coupler
Select a coupler from where? You only show one coupler per product in the m_products dictionary.
How do you know how many radiobuttons there should be?
Are any of these dictionaries fixed count? Which ones?
It loks on the outside like a (relatively) simple 3-level master-detatil scenario.
I just want to try to put together a sample for you and it would be easiest
if I know and understand the data you're working with
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I will try again
A listbox where I can select product, nothing strange here.
Then a Tab with 6 radiobuttons to select Coupler and in that same Tab I have my UserControls.
So when I change selectedItem in my listbox OR change radiobutton, I need to update my UserControls with new data.
ONE of the UserControls in my XAML looks like:
<AttBox:MyAttBox Header="GSM 850" x:Name="AttBox_GSM850"/>
In my code I have (don't care about the private members now, let's say they are public ):
public CouplerDB myDB = new CouplerDB When I want to change in the UC I get the values from:
Product p = (Product)productListbox.SelectedItem;
myDB.m_products[p.ProductName].m_attenuations["Cable"].Values[Band.GSM850][0]
myDB.m_products[p.ProductName].m_attenuations["Cable"].Values[Band.GSM850][1]... so I can set
AttBox_GSM850.LowChRX = myDB.m_products[p.ProductName].m_attenuations["Cable"].Values[Band.GSM850][0];
But to simplify things here... If I have ONE and only ONE UC. I want a Dictionary where each KEY selects, i.e a List<String> to populate the UC listboxes, also want TwoWayBinding. Ehh..I have a testproject, where can I post it?
|
|
|
|