notonyournelly[CodePlex] The number of URLs which can be associated to a person record are dynamic (i.e. not fixed in number). So the GUI changes to the quotphotos and historyquot panel need to be extended to handle an unknown number of URLs. Ideally we need a '+' button to
allow the user to add a URL, and the necessary controls added dynamically in code-behind.
See issue 1475 for the initial part of this task and background.
Some background information for building controls in code:
The one place that comes to mind in the code where I add controls on-the-fly is in the FamilyViewViewer class. See the method MakeBabies.
The key point is that you need a visual container to hold your controls. I.e. in this case you have a ScrollViewer, and inside this scrollviewer you've got a container: maybe a StackPanel. When the user clicks the + button you'll need to create an instance
of the link quotcontrolquot, then add it to the container's Children list:
// container is named 'Contain' in the XAML
TextBox tb = new TextBox();
// set textbox properties
Contain.Children.Add(tb);
I simplified my life a little by creating a UserControl to add to my container. The UserControl acted as a container to hold multiple controls and handle all the details. I don't know if that will be necessary in this case.
The way the Family.Show controls are created, it'll be necessary to quotwipequot any previous state. Clear the container's Children list before showing quotthisquot person's links.
If it proves necessary to force the container to quotrepaintquot (i.e. a new link control doesn't appear after the user clicks the + button), invoking:
// as above, the container is named 'Contain'
Contain.InvalidateVisual();
should take care of it.
notonyournelly[CodePlex]
The number of URLs which can be associated to a person record are dynamic (i.e. not fixed in number). So the GUI changes to the quotphotos and historyquot panel need to be extended to handle an unknown number of URLs. Ideally we need a '+' button to allow the user to add a URL, and the necessary controls added dynamically in code-behind.
See issue 1475 for the initial part of this task and background.
Some background information for building controls in code:
The one place that comes to mind in the code where I add controls on-the-fly is in the FamilyViewViewer class. See the method MakeBabies.
The key point is that you need a visual container to hold your controls. I.e. in this case you have a ScrollViewer, and inside this scrollviewer you've got a container: maybe a StackPanel. When the user clicks the + button you'll need to create an instance of the link quotcontrolquot, then add it to the container's Children list: // container is named 'Contain' in the XAML TextBox tb = new TextBox(); // set textbox properties Contain.Children.Add(tb); I simplified my life a little by creating a UserControl to add to my container. The UserControl acted as a container to hold multiple controls and handle all the details. I don't know if that will be necessary in this case.
The way the Family.Show controls are created, it'll be necessary to quotwipequot any previous state. Clear the container's Children list before showing quotthisquot person's links.
If it proves necessary to force the container to quotrepaintquot (i.e. a new link control doesn't appear after the user clicks the + button), invoking: // as above, the container is named 'Contain' Contain.InvalidateVisual(); should take care of it.