Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:27:48+00:00 2026-06-13T21:27:48+00:00

I Silverlight5 with mvvm pattern i have one doubt. In xaml i have used

  • 0

I Silverlight5 with mvvm pattern i have one doubt.
In xaml i have used one textblock and i bind some id in it.
If the textblock content value is 1 or 2 means
yet another textbox is visible or else that is collapsed.. how to acheive that..

my code:

 <TextBlock Name="textBlock1" Text="{Binding id}" Loaded="textBlock1_Loaded" Visibility="Collapsed" />
<TextBox Text="{Binding name,Mode=TwoWay}"  x:Name="t1" Visibility="{Binding IsVisible,Converter={StaticResource visibilityconverter}}" />

in view model i had created the property for id and raised the event and bind the value to textblock.

to convert the value to visible i have a visibilityconverter class in one separate folder named “Converters”

public class visibilityconverter:IValueConverter
    {

       public object Convert(object value, Type targetType,
                                       object parameter, CultureInfo culture)
        {
            if (id==1 && id==2)
            {
                return Visibility.Visible;
            }
            return Visibility.Collapsed;
        }

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

    }

in the above visibleconverter class how i cna get the id value from viewmodel and check it..
If i got the value from viewmodel to visibilityconverter means i will proceed further.

tell me if u can..!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:27:49+00:00Added an answer on June 13, 2026 at 9:27 pm

    Hi i have found the solution..

     In xaml give the following:
    
    <TextBox Text="{Binding name,Mode=TwoWay}"  x:Name="t1" Visibility="{Binding id,Converter={StaticResource visibilityconverter}}" />
    

    In visibilityConverter class:

    public class visibilityconverter:IValueConverter
    {

    public object Convert(object value, Type targetType,
                                   object parameter, CultureInfo culture)
    {
        string v = value.ToString();
        if (v =="1" ||  v=="2")
        {
            return Visibility.Visible;
        }
        return Visibility.Collapsed;
    }
    
    public object ConvertBack(object value, Type targetType,
                                object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
    

    }

    Problem Solved… !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hai i have doing one simple app in Silverlight5 with MVVM pattern. In design
I'm using Silverlight 5 with mvvm pattern. In xaml page I have one hyperlinkbutton
I have wholly adopted the MVVM pattern for our silverlight app. However, some of
I have one doubt in Silverlight project that using MVVM architecture.. I have an
Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't
I'm writing a Silverlight app using the MVVM pattern. I have a main view
am new to MVVM world ,I have a XAMl like <UserControl x:Class=KeyDownMVVM.MainPage xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I am using Silverlight 4 and MVVM pattern for my application. I have a
One of the many benefits of implementing any pattern is to have a separation
We have application have been written in Silverlight using MVVM pattern. We need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.