Esempio n. 1
0
        public static void OnViewModeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            if (!args.NewValue.Equals(args.OldValue))
            {
                FileList2 fl       = (FileList2)sender;
                ViewMode  viewMode = (ViewMode)args.NewValue;
                if (viewMode == 0)
                {
                    return;
                }

                string viewName = (viewMode.ToString()).Substring(2) + "View";
                switch (viewMode)
                {
                case ViewMode.vmExtraLargeIcon:
                case ViewMode.vmLargeIcon:
                    viewName = "IconView";
                    break;
                }
                ViewBase view = (ViewBase)(fl.TryFindResource(viewName));;

                if (fl.ViewSize < (int)viewMode)
                {
                    fl.ViewSize = (int)viewMode;
                }

                if (view != null)
                {
                    fl.View = view;
                }
                fl.UpdateCollumnHeader();
            }
        }
Esempio n. 2
0
            public override Style SelectStyle(object item, DependencyObject container)
            {
                FileList2 flist = UITools.FindAncestor <FileList2>(container);

                if (flist != null)
                {
                    if (!(flist.View is GridView))
                    {
                        return((Style)flist.FindResource("qz_FileListItem_Style"));
                    }
                }
                return(base.SelectStyle(item, container));
            }
Esempio n. 3
0
        public static void OnViewSizeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            FileList2 flist   = sender as FileList2;
            int       newSize = (int)args.NewValue;

            ViewMode newViewMode = flist.ViewMode;

            switch (newSize)
            {
            case 13: newViewMode = ViewMode.vmTile; break;

            case 14: newViewMode = ViewMode.vmGrid; break;

            case 15: newViewMode = ViewMode.vmList; break;

            case 16: newViewMode = ViewMode.vmSmallIcon; break;

            case 256: newViewMode = ViewMode.vmViewer; break;

            default:
                if (newSize <= 16)
                {
                    newViewMode = ViewMode.vmSmallIcon;
                }
                else
                if (newSize <= 48)
                {
                    newViewMode = ViewMode.vmIcon;
                }
                else if (newSize <= 80)
                {
                    newViewMode = ViewMode.vmLargeIcon;
                }
                else
                {
                    newViewMode = ViewMode.vmExtraLargeIcon;
                }
                break;
            }

            if (newViewMode != flist.ViewMode)
            {
                flist.ViewMode = newViewMode;
            }
        }