Click here to Skip to main content
15,796,456 members
Home / Discussions / C#
   

C#

 
GeneralRe: Drag & Drop how to in Windows Application Pin
GauravGoyal_56-Dec-17 8:20
GauravGoyal_56-Dec-17 8:20 
GeneralRe: Drag & Drop how to in Windows Application Pin
Dave Kreskowiak6-Dec-17 8:22
mveDave Kreskowiak6-Dec-17 8:22 
AnswerRe: Drag & Drop how to in Windows Application Pin
MAIsw7-Dec-17 0:40
MAIsw7-Dec-17 0:40 
QuestionProblem with sending DateTime object to PHP webservice from c# Pin
Snyezana Miletich5-Dec-17 22:34
Snyezana Miletich5-Dec-17 22:34 
AnswerRe: Problem with sending DateTime object to PHP webservice from c# Pin
Jochen Arndt5-Dec-17 22:46
professionalJochen Arndt5-Dec-17 22:46 
GeneralRe: Problem with sending DateTime object to PHP webservice from c# Pin
Snyezana Miletich6-Dec-17 0:12
Snyezana Miletich6-Dec-17 0:12 
GeneralRe: Problem with sending DateTime object to PHP webservice from c# Pin
Jochen Arndt6-Dec-17 0:48
professionalJochen Arndt6-Dec-17 0:48 
QuestionAdding dynamically a custom user control into a dockPanel in xaml file Pin
Hervend4-Dec-17 0:10
Hervend4-Dec-17 0:10 
Hi everybody,

I would like to dynamically create a user control which consists in a dialog box whose content depends on the next step to be executed.
That user control will dynamically be loaded (with the relevant parameters) at runtime into a dock panel in the application WPF user interface.

Has somebody an idea on how to proceed?

Xaml code:

<dockpanel margin="5" grid.row="2" grid.column="0" grid.columnspan="2"
="" name="SequencePopUpWindow">



Xaml.cs code:

public SeqPopUpWindow(string sequenceName, string messageToDisplay)
{
UserControl dynamicUserControl = new UserControl();
dynamicUserControl.Width = 200;
dynamicUserControl.Height = 200;
dynamicUserControl.Background = new SolidColorBrush(Colors.WhiteSmoke);
dynamicUserControl.Name = sequenceName;
TextBox textBox = new TextBox();
textBox.Text = messageToDisplay;
textBox.IsReadOnly = true;

WrapPanel wrapPanel = new WrapPanel();
wrapPanel.MinWidth = 60;
Thickness margin = wrapPanel.Margin;
margin.Left = 0;
margin.Top = 0;
margin.Right = 10;
margin.Bottom = 0;
wrapPanel.Margin = margin;

Button btnDialogOk = new Button();
btnDialogOk.MinWidth = 60;
btnDialogOk.Content = "Ok";

Button btnDialogCancel = new Button();
btnDialogOk.MinWidth = 60;
btnDialogOk.Content = "Ok";

wrapPanel.Children.Add(btnDialogOk);
wrapPanel.Children.Add(btnDialogCancel);
wrapPanel.Children.Add(textBox);
dynamicUserControl.Content = wrapPanel;
}

But when I call this method using the lines displayed below:

SeqPopUpWindow uc = new SeqPopUpWindow("Hot Boxes","Proceed to speed restriction?");
SequencePopUpWindow.Children.Add(uc);

the built control is not displayed in the user interface at run time.


RV

modified 4-Dec-17 6:23am.

AnswerRe: Adding dynamically a custom user control into a dockPanel in xaml file Pin
Kenneth Haugland4-Dec-17 1:36
professionalKenneth Haugland4-Dec-17 1:36 
AnswerRe: Adding dynamically a custom user control into a dockPanel in xaml file Pin
#realJSOP4-Dec-17 4:11
mve#realJSOP4-Dec-17 4:11 
AnswerRe: Adding dynamically a custom user control into a dockPanel in xaml file Pin
Mycroft Holmes4-Dec-17 14:21
professionalMycroft Holmes4-Dec-17 14:21 
AnswerRe: Adding dynamically a custom user control into a dockPanel in xaml file Pin
Gerry Schmitz4-Dec-17 19:59
mveGerry Schmitz4-Dec-17 19:59 
QuestionAlright. How the heck to they do it? Pin
#realJSOP3-Dec-17 7:37
mve#realJSOP3-Dec-17 7:37 
AnswerRe: Alright. How the heck to they do it? Pin
Luc Pattyn3-Dec-17 12:33
sitebuilderLuc Pattyn3-Dec-17 12:33 
GeneralRe: Alright. How the heck to they do it? Pin
Nathan Minier4-Dec-17 2:18
professionalNathan Minier4-Dec-17 2:18 
AnswerRe: Alright. How the heck to they do it? Pin
Kenneth Haugland4-Dec-17 1:30
professionalKenneth Haugland4-Dec-17 1:30 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 4:02
mve#realJSOP4-Dec-17 4:02 
GeneralRe: Alright. How the heck to they do it? Pin
Kenneth Haugland4-Dec-17 4:12
professionalKenneth Haugland4-Dec-17 4:12 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 4:15
mve#realJSOP4-Dec-17 4:15 
GeneralRe: Alright. How the heck to they do it? Pin
Richard Deeming4-Dec-17 5:32
mveRichard Deeming4-Dec-17 5:32 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 8:03
mve#realJSOP4-Dec-17 8:03 
AnswerRe: Alright. How the heck to they do it? Pin
Nathan Minier4-Dec-17 2:21
professionalNathan Minier4-Dec-17 2:21 
AnswerRe: Alright. How the heck to they do it? Pin
Richard Deeming4-Dec-17 3:03
mveRichard Deeming4-Dec-17 3:03 
GeneralRe: Alright. How the heck to they do it? Pin
#realJSOP4-Dec-17 4:03
mve#realJSOP4-Dec-17 4:03 
Questionhow to clear file folder search on computer? Pin
Le@rner1-Dec-17 19:59
Le@rner1-Dec-17 19:59 

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.