Solved

XAMLQuery to show and hide the controls in Silverlight 4.0 xaml

Posted on 2011-02-23
4
760 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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 …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
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…

733 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