简体   繁体   中英

Win8 wp8 binding variation?

I pass an application from wp8 to win8 and all binding failed in textblock and i don't understand why. Exemple textblock :

<TextBlock  Grid.Row="1" Height="Auto" TextAlignment="Left" Text="{Binding SimulClassement,Converter={StaticResource ClassementConverter}}" Visibility="{Binding VisibilityResultat}" Foreground="#FFFF7901" HorizontalAlignment="Left" VerticalAlignment="Top"/>

My property is like :

private string _simulClassement;
        public string SimulClassement
        {
            get { return _simulClassement; }
            set
            {
                _simulClassement = value;
                RaisePropertyChanged("SimulClassement");
            }
        }

SimulClassement property is already set in my viewmodel but i have nothing in view... I forgot something???

Regars.

Edit:

public class ClassementConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value != null)
            {
                return " Classement : " + value;
            }
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }

I set this property with : SimulClassement = GetSimulClassement(CalculPoints(CalculNombreVictoire(CalculVe2I(SelectedProfile.Classement), SelectedProfile.Classement)), SelectedProfile.Classement, false);

i found my probleme. I have copy past my code with a wrong thing.When i copy past my code, propertychange event was not know in my all view model.So, like a noob, i create for all classes the property and method. My viewmodel was hanging to my property change who was null all time...I need juste to create one time.(virtual method)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM