Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello every body....
i have a tag textbox in my project!
i want every time my user clicks on button or "ENTER" a text block show up and contain it's textblock.text content's!!
then i want to in another page's, when user look's at details of a product, some textblock's with tag's on'em show up....
i want to customize the size of the text's to show the one's with more similar tag's( like one tag has been used 5 time's! must be bigger than a tag with 2 time's of use!!
data base has been done! but how can i make the textblock's in runtime?!
Posted
Comments
[no name] 12-Oct-12 14:49pm    
The same way you do everything else! Textblock tb = new Textblock();!!
[no name] 12-Oct-12 14:57pm    
The exact same way you do for everything else... What exactly does LINQ have to do with anything in your question?
senaps 12-Oct-12 15:04pm    
i think i just got confused!! when i look at the answer, i just want to shoot myself!! how did i forget that thing?!!
maybe i thought there is a simpler way to do that! i was scared of it's margin and... to write them in my own!
thanks man...
Sergey Alexandrovich Kryukov 12-Oct-12 14:57pm    
Exactly. I have my method of learning concrete things and explaining to CodeProject members how to do it. Please see my answer -- very general and robust approach... :-)
--SA
senaps 12-Oct-12 15:06pm    
yea.... i had done it for making messageboxes! and button's!!! but didn't really remember it since last 5 hour's!!
but i agree... i' gonna check to do some project's in you way...that help's me alot if don't forget'em.... must write some new cheat paper!

1 solution

All controls are always added during run time, anyway. You don't see it directly only because you add some controls (or all of them) in XAML, and the actual "adding" code is not shown to you as the source code, because the real source is XAML. But you don't think they are added my some mystical "force", do you? :-)

Here is what happens: you author layout in XAML, and, during the build, the actual code is first generated using the XAML, compiled in a usual way and used by application.

So, now you want to do some of such code with your own hands? Right, there are many cases when you really need it; and XAML is just awkward to use or does not provide enough expressing capabilities. There is a lot of code which cannot be expressed in XAML.

So, here is my, very general advice which will cover many similar questions. First, try to do what you need in a simplified sample, in XAML, in some temporary prototype application. Build it. Find auto-generated C# files — if will find them in directory structure under the location of the project file. Load the files and see how things work in C#. Learn it and then use in your work.

Simple and general, isn't it? This approach never failed. :-)

Good luck,
—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900