firstfloorsoftware / mui

Modern UI for WPF
Microsoft Public License
2.6k stars 757 forks source link

MVVM problem #23

Open mjasin opened 9 years ago

mjasin commented 9 years ago

Hi everyone. I have problem with MVVM light framework. When i raise change from ViewModel class, GUI don't change nothing

XAML code:

<Button Width="210" Height="35" Name="bmuiObiekt" Margin="5">
    <Button.Content>
        <TextBlock Text="{Binding Path=LabelObiekt, Mode=TwoWay}"/>
    </Button.Content>
</Button>

c# code:

private string _labelObiekt = "Obiekt [{1} szt.]";
public string LabelObiekt
{
   get { return _labelObiekt; }
   set
   {
       if (_labelObiekt != value)
       {
           _labelObiekt = value;
           RaisePropertyChanged(() => LabelObiekt);
       }
   }
}

change button text from task

net.marcorp.charon.modernui.Threading.Tasks.AppTaskScheduler.Current.RegisterTask(this.GetType().FullName, () =>
{
    using (OracleCore.Charon.CharonDataSetTableAdapters.CHARON_TABLICA_INFTableAdapter tablica = new OracleCore.Charon.CharonDataSetTableAdapters.CHARON_TABLICA_INFTableAdapter())
    {
        LabelObiekt = string.Format(
            "{0} [{1} szt.]",
            "Obiekt",
            tablica.GetInObjectEntryCount().GetValueOrDefault(0));
    }});

Pleas Help

macgile commented 9 years ago

Hi mjasin

try : UpdateSourceTrigger=PropertyChanged

mjasin commented 9 years ago

Hi mjasin

try : UpdateSourceTrigger=PropertyChanged

I've tried, and isn't work with this code.

tiger3t commented 8 years ago
    private void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = this.PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }

is there anybody know this.PropertyChanged is null ,So the binding is not useful ,Why?

GUI don't change because this.PropertyChanged is null ,