Необходимо получить имя привязывающего объекта в коде позади.
<telerik:RadGridView x:Name="grdCoverContent" AutoGenerateColumns="False" CanUserInsertRows="False" IsSynchronizedWithCurrentItem="True"
GridLinesVisibility="Horizontal" telerik:StyleManager.Theme="Windows8" VerticalAlignment="Top"
ShowGroupPanel="False" ItemsSource="{Binding CoverContentCollection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True }"
SelectedItem="{Binding SelectedCoverContent,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Source={StaticResource CoverViewModel} }" RowHeight="30" CellValidating="grdCoverContent_CellValidating" >
Есть ли способ получить имя привязки как "CoverContentCollection",
Заранее спасибо.
На самом деле вам нужен Binding Path
(на самом деле это свойство Path
свойства PropertyPath
). Так что просто получите привязку и получите доступ к ее пути следующим образом:
var path = grdCoverContent.GetBindingExpression(ItemsControl.ItemsSourceProperty)
.ParentBinding.Path.Path;
Код должен запускаться при загрузке окна.