Solved

XAMLQuery to show and hide the controls in Silverlight 4.0 xaml

Posted on 2011-02-23
4
759 Views
Last Modified: 2013-11-12
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
Comment
Question by:poojasureshkumar
  • 2
4 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 35005116
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
 

Author Comment

by:poojasureshkumar
ID: 35009287
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
 
LVL 3

Accepted Solution

by:
politex earned 500 total points
ID: 35171526
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
 

Author Comment

by:poojasureshkumar
ID: 35193414
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question