コード例 #1
0
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        if (item == null || container is null)
        {
            return(null);
        }

        return(item switch
        {
            PaletteEditorViewModel _ => PaletteEditorTemplate,
            ScatteredArrangerEditorViewModel _ => ScatteredArrangerEditorTemplate,
            SequentialArrangerEditorViewModel _ => SequentialArrangerEditorTemplate,
            DataFileEditorViewModel _ => DataFileEditorTemplate,
            IndexedPixelEditorViewModel _ => PixelEditorTemplate,
            DirectPixelEditorViewModel _ => PixelEditorTemplate,
            ProjectTreeViewModel _ => ProjectTreeTemplate,
            _ => base.SelectTemplate(item, container)
        });
コード例 #2
0
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        var document = item as LayoutDocument;

        if (document == null || container is null)
        {
            return(null);
        }

        var content = document.Content;

        return(content switch
        {
            PaletteEditorViewModel _ => PaletteDocumentHeaderTemplate,
            ScatteredArrangerEditorViewModel _ => ScatteredArrangerDocumentHeaderTemplate,
            SequentialArrangerEditorViewModel _ => SequentialArrangerDocumentHeaderTemplate,
            DataFileEditorViewModel _ => DataFileDocumentHeaderTemplate,
            IndexedPixelEditorViewModel _ => PixelDocumentHeaderTemplate,
            DirectPixelEditorViewModel _ => PixelDocumentHeaderTemplate,
            ProjectTreeViewModel _ => ProjectDocumentHeaderTemplate,
            _ => base.SelectTemplate(item, container)
        });