L
L
LiptonOlolo2018-07-21 04:27:22
WPF
LiptonOlolo, 2018-07-21 04:27:22

WPF: How to drive the result of a static method into a ToolTip that receives a value from the model?

Hello.
I’ll tell you right away why I don’t want to transfer the method to the model: the model lies in a separate library and is used in 3 projects, another library is needed for the method to work, which will cause unwanted dependencies.
There is a model, in it there is string sv-in and int sv-in.
There is a static method in which you need to pass a string and an integer value, the output will be a TextBlock, which must be driven into the ToolTip Image'a, which is in the ItemsControl.
How can this be done?
What are the ways?
(ps preferably without code-behinda, mvvm & xaml only)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikita, 2018-07-23
@Smiz001

In the ViewModel, you can also make a special property that will be bound to the ToolTip and this property can be updated depending on any conditions. This will allow you not to create a new property in the model itself. You call your static method on the ViewModel and assign the result to this property.

R
Roman, 2018-07-27
@WNeZRoS

It won't work without code. You need to make an IMultiValueConverter where to bind the string and number. In the converter itself, call this static method. At the same time, the TextBlock that is returned must be new (not used anywhere before), otherwise there will be crashes.

A
Alexander Yudakov, 2018-07-22
@AlexanderYudakov

https://docs.microsoft.com/en-us/dotnet/framework/...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question