Solved

XAMLQuery to show and hide the controls in Silverlight 4.0 xaml

Posted on 2011-02-23
4
762 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

705 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