Click here to Skip to main content
15,914,289 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Small question re: customized controls in WPF Pin
Pete O'Hanlon5-Sep-08 9:32
mvePete O'Hanlon5-Sep-08 9:32 
GeneralRe: Small question re: customized controls in WPF Pin
chaiguy13375-Sep-08 10:55
chaiguy13375-Sep-08 10:55 
AnswerRe: Small question re: customized controls in WPF Pin
Pete O'Hanlon5-Sep-08 10:07
mvePete O'Hanlon5-Sep-08 10:07 
GeneralRe: Small question re: customized controls in WPF Pin
chaiguy13375-Sep-08 10:11
chaiguy13375-Sep-08 10:11 
GeneralRe: Small question re: customized controls in WPF Pin
Insincere Dave5-Sep-08 12:49
Insincere Dave5-Sep-08 12:49 
GeneralRe: Small question re: customized controls in WPF Pin
chaiguy13375-Sep-08 20:06
chaiguy13375-Sep-08 20:06 
GeneralRe: Small question re: customized controls in WPF Pin
Pete O'Hanlon5-Sep-08 22:55
mvePete O'Hanlon5-Sep-08 22:55 
QuestionWPF - Creating Controls Dynamically on a Stack Panel Pin
Jonso4-Sep-08 15:15
Jonso4-Sep-08 15:15 
I am trying to create labels and textboxes dynamically on a stack panel and I can't display them at run time. The reason I am creating them at run time is I have report names and report parameters stored in a table. When I select a report from a treeview I would like to create the corresponding texboxes and labels based on the data I get from the database. Below is the code for creating Report Parameter fields. In Win forms, I could use
pnlParameter.Control.Add(lbl).
private void CreateRptParmsFields(int ReportNameID)
        {
            // reinitialize indexes			
            _currCtrl = _staticCtrlCount + 1;
            BUI.ReportParameterCollection rpc = BUI.ReportParameterCollection.FetchListByReportNameID(ReportNameID);
            foreach (BUI.ReportParameter rp in rpc)
            {
                Label lbl = CreateLabelControl(rp);
                lbl.Tag = rp;
                Control ctrl;
                switch (rp.Control.ToLower())
                { 
                    case "cmb":
                        ctrl = CreateLabelControl(rp);
                        break;
                    default:
                        ctrl = CreateTextBoxControl(rp);
                        break;
                }
             
                //StackPanel p = new StackPanel();

                //stpParameters = p.Children.Add(lbl).ToString();
                //stpParameters = p.Children.Add(ctrl).ToString();
                //pnlParams.Content = lbl;
                //pnlParams.Content = ctrl;
                ////stpParams..Controls.Add(lbl);
                ////stpParams.Controls.Add(ctrl);
            }
            
        }


The two methds below are for creating labels and textboxes respectively.
private TextBox CreateTextBoxControl(BUI.ReportParameter rp)
        {
            TextBox t = new TextBox();
            t.Name = "txt" + rp.Code.Replace("@", "");
            return t;
        }
 private Label CreateLabelControl(BUI.ReportParameter rp)
        {
            Label lbl = new Label();
            lbl.Name = "lbl" + rp.Code.Replace("@", "");
            lbl.Width = 150;
            lbl.Content = rp.Description;
            return lbl;
        }

Can anyone show me how to display those fields on a stack panel.

Thanks
QuestionHow to enable Context menu for a listbox item. Pin
Aslesh4-Sep-08 6:22
Aslesh4-Sep-08 6:22 
AnswerRe: How to enable Context menu for a listbox item. Pin
Pete O'Hanlon4-Sep-08 8:42
mvePete O'Hanlon4-Sep-08 8:42 
Questionparsing HTML files Pin
swatikavdia3-Sep-08 23:33
swatikavdia3-Sep-08 23:33 
AnswerRe: parsing HTML files Pin
Michael Sync18-Oct-08 22:02
Michael Sync18-Oct-08 22:02 
QuestionAudio conferencing using WCF and WPF Pin
sumantamca3-Sep-08 21:55
sumantamca3-Sep-08 21:55 
QuestionParsing XML files [modified] Pin
skrajasthan3-Sep-08 21:52
skrajasthan3-Sep-08 21:52 
GeneralRe: Parsing XML files Pin
Pete O'Hanlon14-Sep-08 22:54
mvePete O'Hanlon14-Sep-08 22:54 
Questionreading XML files Pin
swatikavdia3-Sep-08 21:08
swatikavdia3-Sep-08 21:08 
AnswerRe: reading XML files Pin
Michael Sync18-Oct-08 22:08
Michael Sync18-Oct-08 22:08 
QuestionTextbox validation Pin
Aslesh3-Sep-08 4:52
Aslesh3-Sep-08 4:52 
AnswerRe: Textbox validation Pin
Pete O'Hanlon3-Sep-08 10:21
mvePete O'Hanlon3-Sep-08 10:21 
QuestionHow to animate Expander ? Pin
hdv2123-Sep-08 1:17
hdv2123-Sep-08 1:17 
AnswerRe: How to animate Expander ? Pin
Pete O'Hanlon3-Sep-08 1:25
mvePete O'Hanlon3-Sep-08 1:25 
QuestionAbout eml file parsing in silverlight Pin
skrajasthan2-Sep-08 23:58
skrajasthan2-Sep-08 23:58 
QuestionAdvantages of Silver light for user using silver light application ? Pin
King Shez2-Sep-08 21:47
King Shez2-Sep-08 21:47 
QuestionHelp: Audio conferencing using WCF Pin
Jasvinder Kumar Bali2-Sep-08 20:53
Jasvinder Kumar Bali2-Sep-08 20:53 
QuestionSaving a image of WPF form Pin
shazaduh2-Sep-08 10:03
shazaduh2-Sep-08 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.