InternalViewModel 유형의 속성이있는 ViewModel을 가지며 컬렉션 속성을 갖습니다. DesignInstance : 중첩 된 컬렉션 속성이 인식되지 않습니다.
다음 구문을 필요로 내부 수집을 결합, 뷰의 DataContext에이 뷰 모델의 인스턴스 인 것을 감안할 때 예상대로 런타임시{Binding InternalViewModelProperty.Collection}
그냥 작동합니다. 그러나 DesignInstance를 프록시로 사용하여 내 ViewModel 객체를 나타내는 경우 디자인 타임에 콜렉션이 전혀 표시되지 않습니다 (예 : 자동 생성 열 없음).
{Binding Collection}
는 그 다음 디자인 타임에 다시 작동합니다
내가 속임수와 뷰 모델 속성으로 컬렉션 속성을 노출하고 바인딩을 변경하면
.ViewModel에 속한 다른 속성 내의 속성으로 중첩 된 컬렉션이 디자인 타임에 다르게 작동하는 이유가 있습니까? 이것이 DesignInstance의 한계입니까? 여기
가 XAML 코드입니다 : 그 '아무튼 경우d:DataContext="{d:DesignInstance Type=local:MyViewModel, IsDesignTimeCreatable=True}"
: 모든
<UserControl
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"
xmlns:local="clr-namespace:LocalNS"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
mc:Ignorable="d"
x:Class="MyUserControl"
d:DataContext="{d:DesignInstance Type=local:MyViewModel}"
>
<Grid>
<DataGrid ItemsSource="{Binding InternalViewModelProperty.Collection}"/>
</Grid>
</UserControl>
InternalViewModelProperty는 인터페이스 INotifyPropertyChanged를 노출합니까? – Tony
예. 그러나 Collection 속성은 읽기 전용이므로 변경된 속성으로 "Collection"을 사용하여 PropertyChanged를 발생시키지 않습니다. AFAIK이게 문제가 아니지, 그렇지? – Crono
표시 xaml DesignInstance를 어떻게 설정 했습니까? –