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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:39:28+00:00 2026-05-31T15:39:28+00:00

I have an issue with something that should be very simple databinding scenario. I

  • 0

I have an issue with something that should be very simple databinding scenario. I want to bind a list of items. I want to create a user control put it in a ItemsControl’s template and bind the ItemsControl to some data. I am perfectly happy with one time databinding so I was kind of hoping to avoid learning about dependency properties and all the databinding stuff for this simple scenario.

Here is the XAML for the user control:

<TextBlock>Just Something</TextBlock>

And the code behind:

namespace TestWindowsPhoneApplication
{
    public partial class TestControl : UserControl
    {
        public TestData SomeProperty { get; set; }
        public String SomeStringProperty { get; set; }

        public TestControl()
        {
            InitializeComponent();
        }
    }
}

MainPage.xaml:

<ItemsControl Name="itemsList" ItemsSource="{Binding}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <t:TestControl SomeStringProperty="{Binding Path=SomeString}"></t:TestControl>
            <!--<TextBlock Text="{Binding Path=SomeString}"></TextBlock>-->
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

Here is MainPage.xaml.cs:

namespace TestWindowsPhoneApplication
{
    public class TestData
    {
        public string SomeString { get; set; }
    }

    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            itemsList.DataContext = new TestData[] { new TestData { SomeString = "Test1" }, new TestData { SomeString = "Test2" } };
        }
    }
}

When I run the project I get an error “the parameter is incorrect”. I also tried binding directly to the item with SomeProperty={Binding} since that is what I actually want to do but this causes the same error. If I try doing the same thing with the TextBlock control (the commented line) everything works fine.

How can I implement this simple scenario?

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

    To make a property on your custom control “bindable” you have to make it a dependency property. Check out my answer here for a nice simple example of doing just this on a custom control: passing a gridview selected item value to a different ViewModel of different Usercontrol

    public string SomeString
    {
        get { return (string)GetValue(SomeStringProperty); }
        set { SetValue(SomeStringProperty, value); }
    }
    public static readonly DependencyProperty SomeStringProperty =
        DependencyProperty.Register("SomeString", typeof(string), typeof(TestControl),
        new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnSomeStringChanged)));
    
    private static void OnSomeStringChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        ((TestControl)d).OnSomeStringChanged(e);
    }
    
    protected virtual void OnSomeStringChanged(DependencyPropertyChangedEventArgs e)
    {
        //here you can do whatever you'd like with the updated value of SomeString
        string updatedSomeStringValue = e.NewValue;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue with watin test that should browse for pdf and upload
I have a simple script that should cause one of three divs to be
I think that my issue should be really simple, yet I can not find
I'm having a lot of trouble doing something very simple. I have a viewController
I have to do something very simple, but there doesn't seem to be an
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
I have an issue that is driving me a bit nuts: Using a UserProfileManager
I have big issue with url-rewriting for IIS 7.0. I've written simple module for
My problem seems to be very simple but I'm stuck here. I have a
You'll have to forgive me on this one. I understand that the issue is

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.