Esempio n. 1
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            OrganisingMediaItemPart part = item as OrganisingMediaItemPart;

            if (part != null)
            {
                ContentPresenter cp = container as ContentPresenter;

                if (cp != null)
                {
                    switch (part.Status)
                    {
                    case OrganisingMediaItemPartStatus.Waiting:
                        return((DataTemplate)cp.FindResource("organisingProgressBarTemplate"));

                    case OrganisingMediaItemPartStatus.Organising:
                        return((DataTemplate)cp.FindResource("organisingProgressBarTemplate"));

                    case OrganisingMediaItemPartStatus.Organised:
                        return((DataTemplate)cp.FindResource("organisingSuccessBarTemplate"));

                    case OrganisingMediaItemPartStatus.Error:
                        return((DataTemplate)cp.FindResource("organisingErrorBarTemplate"));
                    }
                }
            }

            return(base.SelectTemplate(item, container));
        }
Esempio n. 2
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ContentPresenter pres = (ContentPresenter)container;

            return(item != null && item is CategoryText
                       ? pres.FindResource("ListItemsTemplate_AuthorTextCategory") as DataTemplate
                       : pres.FindResource("ListItemsTemplate_AuthorText") as DataTemplate);
        }
Esempio n. 3
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ContentPresenter presenter = (ContentPresenter)container;

            if (presenter.TemplatedParent is ComboBox)
            {
                return((DataTemplate)presenter.FindResource("FontFamilyComboCollapsed"));
            }

            // Templated parent is ComboBoxItem
            return((DataTemplate)presenter.FindResource("FontFamilyComboExpanded"));
        }
        public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            ContentPresenter presenter = (ContentPresenter)(container);

            if (Settings.FontSelectionPreview)
            {
                return((DataTemplate)presenter.FindResource("FontItemWithPreview"));
            }
            else
            {
                return((DataTemplate)presenter.FindResource("FontItemWithoutPreview"));
            }
        }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ContentPresenter contentPresenter = container as ContentPresenter;

            ViewModels.ISchemaViewModel element = contentPresenter.Content as ViewModels.ISchemaViewModel;

            if (typeof(ViewModels.FolderSchemaViewModel) == element.GetType())
            {
                return(contentPresenter.FindResource("FolderSchemaEditTemplate") as DataTemplate);
            }
            if (typeof(ViewModels.FileSchemaViewModel) == element.GetType())
            {
                return(contentPresenter.FindResource("FileSchemaEditTemplate") as DataTemplate);
            }
            return(null);
        }
Esempio n. 6
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ContentPresenter pres = container as ContentPresenter;
            var cell = item as ExCell;

            if (cell == null)
            {
                return(null);
            }
            switch (cell.Value.Type)
            {
            case CellValue.CellValType.String: return(pres.FindResource("StrCellTemplate") as DataTemplate);

            case CellValue.CellValType.Numeric: return(pres.FindResource("StrCellTemplate") as DataTemplate);

            case CellValue.CellValType.Date: return(pres.FindResource("DateTimeCellTemplate") as DataTemplate);

            case CellValue.CellValType.Time: return(pres.FindResource("TimeCellTemplate") as DataTemplate);
            }
            return(null);
        }
Esempio n. 7
0
        public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            Models.FileContent file = item as Models.FileContent;
            ContentPresenter   pres = container as ContentPresenter;
            DataTemplate       dataTemplate;

            if (file is Models.ImageFileContent)
            {
                dataTemplate = pres.FindResource("ImageTemplate") as DataTemplate;
            }
            else if (file is Models.TextFileContent)
            {
                dataTemplate = pres.FindResource("TextTemplate") as DataTemplate;
            }
            else
            {
                dataTemplate = pres.FindResource("SimpleTemplate") as DataTemplate;
            }

            return(dataTemplate);
        }
Esempio n. 8
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ContentPresenter pres = container as ContentPresenter;

            if (item is StrFilter)
            {
                return(pres.FindResource("StrFilterTemplate") as DataTemplate);
            }
            if (item is NumericFilter)
            {
                return(pres.FindResource("NumericFilterTemplate") as DataTemplate);
            }
            if (item is DateFilter)
            {
                return(pres.FindResource("DateFilterTemplate") as DataTemplate);
            }
            if (item is TimeFilter)
            {
                return(pres.FindResource("TimeFilterTemplate") as DataTemplate);
            }
            return(null);
        }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            ContentPresenter cp = container as ContentPresenter;
            Boolean          allowMergeExtract = true;

            MediaItemsView miv = VisualTreeHelpers.FindAncestor <MediaItemsView>(container);

            if (miv != null)
            {
                allowMergeExtract = miv.AllowMergeExtract;
            }

            if (allowMergeExtract)
            {
                MediaItem mediaItem = item as MediaItem;

                if (mediaItem.Parts.Count > 1)
                {
                    return((DataTemplate)cp.FindResource("mediaItemPartsRowDetailsTemplate"));
                }
            }

            return((DataTemplate)cp.FindResource("emptyDataTemplate"));
        }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            int number = (int)item;

            if (number > 0)
            {
                if (_nonZeroTemplate == null)
                {
                    ContentPresenter cp = container as ContentPresenter;
                    _nonZeroTemplate = (DataTemplate)cp.FindResource("NonZero");
                }
                return(_nonZeroTemplate);
            }
            else
            {
                if (_zeroTemplate == null)
                {
                    ContentPresenter cp   = container as ContentPresenter;
                    object           test = cp.FindResource("Zero");
                    _zeroTemplate = (DataTemplate)test;
                }
                return(_zeroTemplate);
            }
        }