-1
我有一個接口:WPF:如何綁定到從另一個接口繼承的接口?
public interface IDocument : IEntity
{
string FileName { get; set; }
...
}
public interface IEntity : IComparable
{
int Id { get; set; }
...
}
我想結合如下:
<ItemsControl Grid.Row="0" ItemsSource="{Binding SelectedEventPhotoList}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Name="SelectedListView">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Rows="1" Columns="3"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=(documents:IDocument.FileName)}"/>
<TextBlock Text="{Binding Path=(documents:IDocument.Id)}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
的SelectedEventPhotoList被放置,以查看模型如下:
public List<IDocument> SelectedEventPhotoList
{
get { return _selectedEventPhotoList; }
set
{
if (Equals(value, _selectedEventPhotoList))
return;
_selectedEventPhotoList = value;
RaisePropertyChanged(() => SelectedEventPhotoList);
}
}
第一結合到FileName工作正常,但第二個沒有。
如何使它工作?
@Clemens是不是這些[綁定到顯式接口實現](http://stackoverflow.com/a/1827579/5246145)? – 3615
@ 3615:我做到了。 – tesicg
我已更新原始帖子。請看一下。 – tesicg