0

まあ、私は多くのことがデザイナーを何らかの形で壊してしまうので、運が悪いです(その他の問題

データグリッド ビューでコレクションを使用すると、生成したすべてのダミー コンテンツ行をデザイナーで確認できますが、コレクション ビュー ソースを追加してデータをグループ化すると、これが機能しなくなります。その後、コレクション全体が実行時にのみ表示されます。

これは WPF デザイナーの別の問題ですか?

再現コード:

意見:

<Window x:Class="CollectionViewSourceDesignerBreak.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:collectionViewSourceDesignerBreak="clr-namespace:CollectionViewSourceDesignerBreak" >
    <Window.DataContext>
        <collectionViewSourceDesignerBreak:ViewModel />
    </Window.DataContext>

    <Window.Resources>
        <CollectionViewSource Source="{Binding Entries}" x:Key="Cvs">
            <CollectionViewSource.GroupDescriptions>
                <PropertyGroupDescription PropertyName="Name"/>
            </CollectionViewSource.GroupDescriptions>
        </CollectionViewSource>

    </Window.Resources>


    <DataGrid ItemsSource="{Binding Entries}" AutoGenerateColumns="True">
    <!--<DataGrid ItemsSource="{Binding Source={StaticResource Cvs}}" AutoGenerateColumns="True">-->

    </DataGrid>
</Window>

ダミー ビュー モデル:

using System.Collections.ObjectModel;

namespace CollectionViewSourceDesignerBreak
{
    public class VMData
    {
        public string Name { get; set; }
        public string MoreInfo { get; set; }

    }
    public class ViewModel
    {
        private ObservableCollection<VMData> _entries = new ObservableCollection<VMData>();
        public ObservableCollection<VMData> Entries
        {
            get { return _entries; }
            set { _entries = value; }
        }

        public ViewModel()
        {
            Entries.Add(new VMData{Name="A", MoreInfo = "Some text"});
            Entries.Add(new VMData{Name="B", MoreInfo = "More text"});
            Entries.Add(new VMData{Name="A", MoreInfo = "Other text"});
        }
    }
}

Cvs の行をコメント インし、他の行をコメントアウトすると、内容がデザイナに表示されなくなります。

4

0 に答える 0