M
M
Mikhail Usotsky2017-02-03 16:30:07
WPF
Mikhail Usotsky, 2017-02-03 16:30:07

How to pull specific data in TemplateBinding?

There is such a simple structure:

public class Items
{
    public string Port { get; set; }
    public string Value { get; set; }
}

And I pass it all to the ListBox. The ListBoxItem has a managed ControlTemplate. There was a problem: if you use directly {TemplateBinding Content}. Then it appears as <Class name>+Items. How to extract specific data from Items?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Usotsky, 2017-02-03
@AquariusStar

I'll answer my own question. Solution: Binding Path=Content.Port, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question