Error when referring to label C #

0

Good morning. First of all I appreciate the help. The problem is the following: I'm working on a C # project, exactly WPF, the problem is that when I try to reference a label to change its content (because the property in the WPF label is Content, in Windows Form is Text), strangely the VisualStudio (Community2017) the intelisense does not help me with the reference. Which is why I call the label by the name that was called, I miss the error that it does not appear in the context. Can you give me a hand with this? The truth is I'm new to C # and it's the first time it happens to me. Apart from working on other WindowsForms projects and not on this. Maybe he's doing something wrong.

that's where the name of the label is

    
asked by limg21 14.10.2017 в 00:16
source

2 answers

0

It is not a 100 solution but it is a way that makes life much easier, it is assigning and reading the XAML values by binding

CS Code

private string _etiqueta1;
public String Etiqueta1
{
    get { return _etiqueta1; }
    set
    {
      _etiqueta1= value;
     NotifyPropertyChanged();
  }
}

XAML

<Label Name="lblEtiqueta" Content="{Binding Path=Etiqueta}"/>
    
answered by 14.10.2017 в 00:22
0

check that in the XAML the label has a name, in your case it should be like this

<Label x:Name="labelAssistantSays" />
    
answered by 12.01.2018 в 22:34