How do I modify a label on my XAML code With a C# Function ?
Hi, I have a label with some data and I want to edit it when I launch my function
52 Replies
How in C# I can edit this label ?
You can use data binding.
are you using WPF?
If you are using WPF, this is no problem.
How do you think about it?
Yes
Yeah but idk how to do
Like I have to the the name of my label.Text = "What I want";
Idk how to edit my text
np. If you use data-binding, You can solve perfect this problem.
hang on.
I will provide documentation.
Ok thx
then if you don't understand, let me check your code and help you.
In this pic DesrLabel is the name of the label ?
Like that ?
Yup.
sure
So why I have an error ?
can I check?
This is saying Text is not null
Can i check your project's code if the project have github repository?
That's a private project I'll edit it to left only the important part
So the XAML
send me C# file.
only this part.
let me check.
So ?
You can change Name to x:Name in XAML.
Label's name.
Ho I forgot I change label in textblock to try something srry
Yup.
Same
You can try.
Tried I gave an error
Can I see the error?
Translation : A reference is required for the proprierty, method or field not static "MaintWindow.tested"
sorry.
i can't understand.
I don't know about your language.
Ok np
I translated
...
You can try to write the code in constitutor.
Constitutor ?
in here.
Working
So how can I do to make it possible on my function ?
you can make the function to public.
and then you can try.
Ho thx
and you have to delete static.
Yeah I know
Thx
welcome.\
If you have any qestion, you can contact me at the anytime.
for it, you can send DM.
okay?
Ok thxx
But I think, You have to use data binding in modern projects.
that's good.
All of project with WPF are using MVVM pattern.
Did you know about it?
Send me the Doc plz
A bit
You said send you the docs, that's a search for the docs, learning to search for documentation is an important skill
Wrong conv srry
Yeah but before he said that he'll send me a doc so I was thinking about a more understandable doc not the microsoft doc I got it
Here
?
I talk to @SinFluxx