Changeset 2333


Ignore:
Timestamp:
Jan 13, 2011, 9:32:45 PM (11 years ago)
Author:
sauer
Message:

Added visual help (background color) to underline the relation between selection and description (click through and you'll see)

Location:
trunk/CrypPlugins/Wizard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/Wizard/WizardControl.xaml

    r2302 r2333  
    4848            <RowDefinition Height="Auto" />
    4949        </Grid.RowDefinitions>
    50         <Label HorizontalAlignment="Center" Name="taskHeader" VerticalAlignment="Top" FontSize="18" />
     50        <Label HorizontalAlignment="Center" Name="taskHeader" VerticalAlignment="Top" FontSize="18" Margin="10"/>
    5151        <Grid HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch" Grid.Row="1" >
    5252        <Grid.ColumnDefinitions>
    53             <ColumnDefinition />
     53            <ColumnDefinition Width="Auto" />
    5454            <ColumnDefinition />
    5555        </Grid.ColumnDefinitions>
    56             <ScrollViewer  HorizontalAlignment="Stretch" VerticalAlignment="Top" VerticalScrollBarVisibility="Hidden" >
    57                 <StackPanel Name="radioButtonStackPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="15" />
     56            <ScrollViewer  HorizontalAlignment="Stretch" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" Name="radioButtonScroll" >
     57                <StackPanel Name="radioButtonStackPanel" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
    5858            </ScrollViewer>
    59             <ScrollViewer  HorizontalAlignment="Stretch" VerticalAlignment="Top" VerticalScrollBarVisibility="Hidden" Grid.Column="1">
    60                 <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
     59            <ScrollViewer Name="descScroll" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalScrollBarVisibility="Auto" Grid.Column="1" >
     60                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="{Binding ElementName=radioButtonScroll, Path=ActualHeight}">
    6161                    <Grid.RowDefinitions>
    6262                        <RowDefinition Height="Auto" />
     
    6767                    </Grid.ColumnDefinitions>
    6868                    <Label Name="descHeader" HorizontalAlignment="Center" VerticalAlignment="Stretch" FontSize="14" />
    69                     <TextBlock Name="description" TextWrapping="Wrap" Margin="10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Left" Grid.Row="1" />
     69                    <TextBlock Name="description" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Left" Grid.Row="1" />
    7070                </Grid>
    7171            </ScrollViewer>
  • trunk/CrypPlugins/Wizard/WizardControl.xaml.cs

    r2331 r2333  
    2929
    3030        private List<string> choicePath = new List<string>();
     31        private SolidColorBrush selectionBrush = new SolidColorBrush();
    3132        private const string configXMLPath = "Wizard.Config.wizard.config.start.xml";
    3233        private const string defaultLang = "en-US";
     
    4748               
    4849            }
     50
     51            selectionBrush.Color = Color.FromArgb(255, 200, 220, 245);
     52
    4953            InitializeComponent();
    5054            SetupPage(wizardConfigXML);
     
    134138                foreach (XElement ele in categories)
    135139                {
     140                    ContentControl c = new ContentControl();
    136141                    Label l = new Label();
    137142                    Image i = new Image();
    138143                    StackPanel sp = new StackPanel();
     144                    c.Content = sp;
     145                    c.VerticalAlignment = VerticalAlignment.Stretch;
    139146
    140147                    l.Height = 30;
     148                    l.HorizontalAlignment = HorizontalAlignment.Stretch;
    141149                    XElement label = FindElementInElement(ele, "name");
    142150                    if (label != null)
     
    144152
    145153                    i.Width = 26;
    146                     string image = (string)ele.Attribute("image");
     154                    string image = ele.Attribute("image").Value;
    147155                    if (image != null)
    148156                    {
     
    161169
    162170                    RadioButton rb = new RadioButton();
    163                     string id = (string)ele.Attribute("id");
     171                    string id = ele.Attribute("id").Value;
    164172                    if (id != null)
    165173                        rb.Name = id;
     174                    rb.Checked += rb_Checked;
     175                    rb.HorizontalAlignment = HorizontalAlignment.Stretch;
     176                    rb.VerticalAlignment = VerticalAlignment.Stretch;
     177                    rb.HorizontalContentAlignment = HorizontalAlignment.Stretch;
     178                    rb.Content = c;
     179                    rb.Tag = ele;
     180
     181                    radioButtonStackPanel.Children.Add(rb);
    166182                    if (choicePath.Count > 0 && id == choicePath.Last())
    167183                    {
     
    170186                        nextButton.IsEnabled = true;
    171187                    }
    172                     rb.HorizontalAlignment = HorizontalAlignment.Stretch;
    173                     rb.HorizontalContentAlignment = HorizontalAlignment.Left;
    174                     rb.Checked += rb_Checked;
    175                     rb.Content = sp;
    176                     rb.Tag = ele;
    177 
    178                     radioButtonStackPanel.Children.Add(rb);
    179188                }
    180189            }
     
    184193        void rb_Checked(object sender, RoutedEventArgs e)
    185194        {
     195            ResetBackground();
    186196            RadioButton b = (RadioButton)sender;
     197            ContentControl c = (ContentControl)b.Content;
     198            StackPanel sp = (StackPanel)c.Content;
     199            sp.Background = selectionBrush;
    187200            XElement ele = (XElement)b.Tag;
    188201            XElement desc = FindElementInElement(ele, "description");
    189202            if (desc != null)
    190203                description.Text = desc.Value;
     204            descScroll.Background = selectionBrush;
    191205            nextButton.IsEnabled = true;
     206        }
     207
     208        private void ResetBackground()
     209        {
     210            UIElement[] uiea = new UIElement[radioButtonStackPanel.Children.Count];
     211            radioButtonStackPanel.Children.CopyTo(uiea, 0);
     212            foreach (UIElement uie in uiea)
     213            {
     214                RadioButton b = (RadioButton)uie;
     215                ContentControl c = (ContentControl)b.Content;
     216                StackPanel sp = (StackPanel)c.Content;
     217                sp.Background = Brushes.Transparent;
     218            }
     219            descScroll.Background = Brushes.Transparent;
    192220        }
    193221
     
    217245        private void nextButton_Click(object sender, RoutedEventArgs e)
    218246        {
     247            ResetBackground();
    219248            UIElement[] uiea = new UIElement[radioButtonStackPanel.Children.Count];
    220249            radioButtonStackPanel.Children.CopyTo(uiea, 0);
     
    235264        private void backButton_Click(object sender, RoutedEventArgs e)
    236265        {
     266            ResetBackground();
    237267            UIElement[] uiea = new UIElement[radioButtonStackPanel.Children.Count];
    238268            radioButtonStackPanel.Children.CopyTo(uiea, 0);
     
    253283        private void abortButton_Click(object sender, RoutedEventArgs e)
    254284        {
     285            ResetBackground();
    255286            radioButtonStackPanel.Children.Clear();
    256287            choicePath.Clear();
Note: See TracChangeset for help on using the changeset viewer.