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 182779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:00:00+00:00 2026-05-11T15:00:00+00:00

In Silverlight 2…. I have a RadioButton in my xaml code as follows: <RadioButton

  • 0

In Silverlight 2….

I have a RadioButton in my xaml code as follows:

<RadioButton GroupName='Gender' Content='Male' IsChecked='{Binding Path=Gender, ConverterParameter=1, Mode=TwoWay, Converter={StaticResource RadioStringConverter}}' Width='49' HorizontalAlignment='Left'/> 

This works great. My issue is in trying to duplicate this functionallity dynamically.

RadioButton rb = new RadioButton() {GroupName = 'Gender', Content = 'Male' ,Width = (double)49,HorizontalAlignment = System.Windows.HorizontalAlignment.Left}; 

this works but when I try to put the converter in, it breaks. What is the proper way to do this? Any good working examples?

Here is what I tried….

RadioButton rb = new RadioButton() {GroupName = 'Gender', Content = 'Male' ,Width = (double)49,HorizontalAlignment = System.Windows.HorizontalAlignment.Left};  RadioStringConverter rsc = new RadioStringConverter();  Binding binding = new Binding(layout.FieldName) { Source = mainLayout.DataContext, Mode = BindingMode.TwoWay,ConverterParameter = 1,Converter = rsc};  // to emulate the '{StaticResource RadioStringConverter}'};  rb.SetBinding(RadioButton.IsCheckedProperty, binding);  sp.Children.Add(rb); 

Although this compiles fine, it does not run correctly. 1) How do I reference the static resource dynamically? 2) How do I add this static resource to the XAML dynamically? Right now I have this reference hard coded.

Am I making this more difficult than it needs to be?

  • 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. 2026-05-11T15:00:00+00:00Added an answer on May 11, 2026 at 3:00 pm

    Solution found…. Basically I had to create an instance of the converter class and pass it’s interface to the converter as such:

    Binding binding = new Binding(layout.FieldName) { Source = mainLayout.DataContext, Mode = BindingMode.TwoWay,ConverterParameter = 1,Converter = (rsc as IValueConverter)}; 

    Glad it turned out simple and doable 🙂

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

Sidebar

Related Questions

In Silverlight 3.0 I have added a custom behavior to some UIElement in Code
silverlight 4 <ControlTemplate x:Key=MyTabItemContentTemplate> <StackPanel> <TextBlock Text={Binding Path=name} /> <Popup x:Name=contextMenu IsOpen=False> <Border Background=#A5FBFBFB
In Silverlight/XAML you have namespaces such as: xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml and so elements have namespaced attributes
In Silverlight, I've got a hyperlinkbutton defined as the following: <HyperlinkButton Content={Binding FileName} NavigateUri={Binding
Silverlight newbie question: I've got a small Silverlight application with the following XAML snippet:
Silverlight, Flash, and JavaScript, oh my.. I have a couple of applications that I
Silverlight does not support Alternating Item Templates in an ItemsControl. I have a few
Silverlight is case sensitive for query string parameters so the following code would return
In Silverlight 4, BinaryReader doesn't seem to have any ReadDecimal() method. Reflector shows that
This silverlight code throws an error Cannot invoke a non-delegate type var WshShell =

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.