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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:10:37+00:00 2026-06-04T13:10:37+00:00

I am using MvxBindableListView to bind a List<> of data objects to a ListView

  • 0

I am using MvxBindableListView to bind a List<> of data objects to a ListView. The layout I am using for the rows has several TextViews. I am successfully binding the Text property for each of these to a property in my data object, but I have found that I cannot bind to TextColor as that property does not exist in Mono For Android TextViews; instead you have use the SetTextColor() method. So how can I bind a data object property to a method?! Below is the code I tried to use:

    <TextView
        android:id="@+id/MyValueTextView"
        android:layout_width="50dp"
        android:layout_height="20dp"
        android:layout_gravity="right"
        android:gravity="center_vertical|right"
        android:textSize="12sp"
        local:MvxBind="
        {
          'Text':{'Path':'MyValue','Converter':'MyValueConverter'},
          'TextColor':{'Path':'MyOtherValue','Converter':'MyOtherConverter'}
        }" />
  • 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-04T13:10:39+00:00Added an answer on June 4, 2026 at 1:10 pm

    There’s an example of adding a custom 2-way binding for “IsFavorite” in the Conference sample – see:

    • the binding – https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.UI.Droid/Bindings/FavoritesButtonBinding.cs
    • the binding setup in FillTargetFactories in https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.UI.Droid/Setup.cs

    This example is explained a bit further in: MVVMCross Bindings in Android

    For a one-way “source-to-target” custom binding, the code should be a bit simpler – you only need to handle the SetValue – and don’t need to invoke FireValueChanged in any event handling code.


    For textColor, I’d imagine the binding would look a bit like:

    public class MyCustomBinding
        : MvxBaseAndroidTargetBinding
    {
        private readonly TextView _textView;
    
        public MyCustomBinding(TextView textView)
        {
            _textView = textView;
        }
    
        public override void SetValue(object value)
        {
            var colorValue = (Color)value;
            _textView.SetTextColor(colorValue);
        }
    
        public override Type TargetType
        {
            get { return typeof(Color); }
        }
    
        public override MvxBindingMode DefaultMode
        {
            get { return MvxBindingMode.OneWay; }
        }
    }
    

    and would be setup with:

        protected override void FillTargetFactories(MvvmCross.Binding.Interfaces.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry registry)
        {
            base.FillTargetFactories(registry);
    
            registry.RegisterFactory(new MvxCustomBindingFactory<TextView>("TextColor", (textView) => new MyCustomBinding(textView)));
        }
    

    Note: I’ve not compiled this example code – when you do get it working, please come back and correct this pseudo-code 🙂

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

Sidebar

Related Questions

Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using PHP, I can convert MySQL data or static table data to csv, Excel,
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using Android TelephonyManager an application can obtain the state of data activity over the
Using Core Data, I have a fetch request to fetch the minimum of a
Using C#, I need a class called User that has a username, password, active
Using Rails 3.1. I have some pages that render same layout, except the contents
Using Yii, I want to delete all the rows that are not from today.
Using EF Code First I have an model object that has multiple properties that
Using LINQ on collections, what is the difference between the following lines of code?

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.