This article will describe for you how to use LongBindingPath using WPF. This is small example but very useful in WPF.
First of all make a new WPF application and add a new page using "Add New Item" then drag and drop some controls onto page. I have added one list box with a few listboxitems and I have added a textbox and lables. When we select any item of listbox the selected value will show in label.
Content="{Binding ElementName=TestPage, Path=Content.Children[1].SelectedItem.Content}">
Here is my full .xaml code
<Page x:Class="WPFBinding.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" FontSize="14pt" Name="TestPage">
<StackPanel>
<TextBlock Name="textBlock1" Text="First element in stack panel" HorizontalAlignment="Center" />
<ListBox Name="listBox1" HorizontalAlignment="Center" Margin="24" Width="208" Height="132">
<ListBoxItem Content="Raj Kumar Beniwal" />
<ListBoxItem Content="Jeniffer Tapagia jenny" />
<ListBoxItem Content="Kishan Kant Kahu" />
<ListBoxItem Content="Sama Sikandar Jetli" />
<ListBoxItem Content="Jeenat Chatterjee" />
</ListBox>
<TextBlock Name="textBlock2" HorizontalAlignment="Center">
<Label Content="Number of character in fourth list box item = "></Label>
<Label Content="{Binding ElementName=TestPage, Path=Content.Children[1].Items[3].Content.Length}" Name="label1" />
<LineBreak></LineBreak>




Join the conversation! Your thoughts help the community grow.