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

  • Home
  • SEARCH
  • 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 5850101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:05:37+00:00 2026-05-22T13:05:37+00:00

I have a custom class Spieltag containing a property SpieltagDaten (custom class). SPieltagDaten has

  • 0

I have a custom class Spieltag containing a property SpieltagDaten (custom class). SPieltagDaten has a property called SpieleGespielt. I have set this property as target of a binding on textbox text-property.

The binding works just fine as the initial value of the property is beeing displayed but when the property changes the textbox is not beeing updated.

The PropertyChanged event is fired and the parameter is spelled correctly.

This is what the code looks like:

This is the textbox with binding:

<TextBlock Name="textBlockGespielt" 
    Text="{Binding Path=MySpieltag.Daten, 
           Converter={util:SpieltagDatenToStringConverter},
           ConverterParameter=SpieleGespielt, 
           UpdateSourceTrigger=PropertyChanged}" />

In constructor of the window I set

this.DataContext = this;

This is the root-class of the model containing a property called Daten:

public class Spieltag : ModelBase    {

    private ISpieltagDaten daten;

    public ISpieltagDaten Daten
    {
        get { return daten; }
        set { daten = value; Changed("Daten"); }
    }
}

SpieltagDaten contains a property SpieleGespielt

public class SpieltagDaten : ModelBase, interfaces.ISpieltagDaten
{
    private int _spieleGespielt;

    public Int32 SpieleGespielt
    {
        get { return _spieleGespielt; }
        set { _spieleGespielt = value; Changed("SpieleGespielt"); }
    }
}

ModelBase implements INotifyPropertyChanged:

public class ModelBase: INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged = delegate { };

    protected void Changed(String propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

edit:

I forget to post the Converter. It’s derived from MarkupExtension so I can use it easy in xaml:

class SpieltagDatenToStringConverter : MarkupExtension, IValueConverter
{
    private static SpieltagDatenToStringConverter _converter = null;
    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        if (_converter == null)
        {
            _converter = new SpieltagDatenToStringConverter();
        }
        return _converter;
    }

    public object Convert(object value, Type targetType,
        object parameter, System.Globalization.CultureInfo culture)
    {
        ISpieltagDaten daten = (ISpieltagDaten)value;

        string res = String.Empty;

        string propertyName = parameter.ToString();


            PropertyInfo pi = typeof(ISpieltagDaten).GetProperty(propertyName);

            if (pi != null)
            {
                 res = pi.GetValue(daten,null).ToString();
            }

        return res;
    }


    public object ConvertBack(object values, Type targetType,
        object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

The converter is beeing called on the initial setup of the model.
enter image description here

  • 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-22T13:05:38+00:00Added an answer on May 22, 2026 at 1:05 pm

    your Converter is not specified correctly. Specify an instance of your converter class in the UserControl.Resources and then reference that instance in your TextBlock

    <UserControl.Resources>
        <util:SpieltagDatenToStringConverter x:Key="mySpieltagDatenToStringConverter" />
    </UserControl.Resources>
    
    <TextBlock Name="textBlockGespielt" 
        Text="{Binding Path=MySpieltag.Daten, 
               Converter={StaticResource mySpieltagDatenToStringConverter},
               ConverterParameter=SpieleGespielt, 
               UpdateSourceTrigger=PropertyChanged}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom class, with a property ID. We can name this class
I have a custom class called card and I need to create a set
I have a custom class set up as a key that has two properties,
I have a custom class that has as an instance variable of a coordinate:
I have a custom class that uses boost mutexes and locks like this (only
I have a custom class say 'MyCanvas' derived from wpf Canvas class. MyCanvas has
I have this custom class which extends EventDispatcher private var assetsManager:AssetManager; And this running
I have a custom class containing 2 public variables: 1 is a string and
I have a custom class, and that class has a UIButton instance variable. I
I have a custom class that, when called, will redirect to a page and

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.