Exemplo n.º 1
0
        private void Setup()
        {
            for (int j = 0; j < mBailCond.Conditions.Count; ++j)
            {
                var aRowDef = new RowDefinition
                {
                    Height = GridLength.Auto
                };
                mConditionsInputGrid.RowDefinitions.Add(aRowDef);
            }

            int i = 0;

            foreach (var aCond in mBailCond.Conditions)
            {
                mConditionList.Items.Add(new ListBoxItem {
                    Content = aCond.ShortText
                });

                var aPanel = new WrapPanel
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    Margin            = new Thickness(0),
                    Opacity           = 0.0,
                    VerticalAlignment = VerticalAlignment.Top,
                    Visibility        = Visibility.Visible
                };

                // Draw the elements higher in the grid last so they're on the top.
                // This lets us always have the elements loaded but hidden so we always know their height
                // which makes the animation easier.
                WrapPanel.SetZIndex(aPanel, mBailCond.Conditions.Count - i);
                // As soon as the panel is loaded we immediately hide it behind the above row. Since we
                // know the actual height at that point it's the best time to do it. Since it starts out
                // as transparent you can't see it anyway.
                aPanel.Loaded += APanel_Loaded;
                mConditionsInputGrid.Children.Add(aPanel);
                Grid.SetRow(aPanel, i);
                mConditionPanels.Add(aPanel);

                //UpdateGender(BailCond.EGender.Male);

                ++i;
            }
        }