• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 769
  • Last Modified:

XAMLQuery to show and hide the controls in Silverlight 4.0 xaml

Hi Experts,
I am using accordion control in silverlight 4.0 xaml. I need to hide the certain  labels , dropdowns, checkboxes, text boxes, radio buttons based on input passed into xaml page.Advance thanks.

Kind regards,
Pooja
0
poojasureshkumar
Asked:
poojasureshkumar
  • 2
1 Solution
 
Gautham JanardhanCommented:
can u give some more details please... where will these items be ? in accordion item ? are u using tool kit accordion or any other third party controls ?
0
 
poojasureshkumarAuthor Commented:
Hi Qauthampi,
Items are in Accordion items. I am using accodrion took kit. Is there any way to use ajaxtool kit here. Because i am using so much accordion items and i could find difficulty in displaying controls for each accordion item.
Is there any way to show popup (with list of controls which was there for accordion item)  when i hit the accordion header.

Kind regards,
Pooja
0
 
politexCommented:
Hi, it can be implemented like this


<UserControl.Resources>
        <my:Bool2Visibility x:Key="Bool2Visibility1" />
    </UserControl.Resources>
    <StackPanel>
    <toolkit:Accordion Height="150" x:Name="accordion1" Width="392" >
        <toolkit:Accordion.Items>
                <toolkit:AccordionItem Header="1" Visibility="{Binding ElementName=a1, Path=IsChecked, Mode=TwoWay, Converter={StaticResource Bool2Visibility1}}" />
                <toolkit:AccordionItem Header="2" Visibility="{Binding ElementName=a2, Path=IsChecked, Mode=TwoWay, Converter={StaticResource Bool2Visibility1}}"/>
                <toolkit:AccordionItem Header="3" Visibility="{Binding ElementName=a3, Path=IsChecked, Mode=TwoWay, Converter={StaticResource Bool2Visibility1}}"/>
                <toolkit:AccordionItem Header="4" Visibility="{Binding ElementName=a4, Path=IsChecked, Mode=TwoWay, Converter={StaticResource Bool2Visibility1}}"/>
        </toolkit:Accordion.Items>
    </toolkit:Accordion>
    <Popup IsOpen="True">
            <ListBox>
                <CheckBox x:Name="a1">1</CheckBox>
                <CheckBox x:Name="a2">2</CheckBox>
                <CheckBox x:Name="a3">3</CheckBox>
                <CheckBox x:Name="a4">4</CheckBox>
            </ListBox>
    </Popup>
    </StackPanel>

Open in new window

public class Bool2Visibility : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (!(value is bool)) return Visibility.Collapsed;
            return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

Open in new window

0
 
poojasureshkumarAuthor Commented:
Hi politex,
Thanks for a advice. I need to buy some additional time to test it since i am working on something else. Thanks for the patience.

Kind regards,
Pooja
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now