Beispiel #1
0
        private static bool IsRightAligned(GridColumnDefinition column)
        {
            var displayTextColumn = column as DisplayTextColumnDefinition;

            if (displayTextColumn != null)
            {
                return(displayTextColumn.IsRightAligned);
            }

            if (column is IntegerColumnDefinition || column is CurrencyColumnDefinition)
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        internal static ColumnDefinition GenerateColumnDefinition(GridColumnDefinition column)
        {
            var definition = new ColumnDefinition();

            switch (column.WidthType)
            {
            case GridColumnWidthType.Fill:
                definition.Width = new GridLength(1, GridUnitType.Star);
                break;

            case GridColumnWidthType.Auto:
                definition.Width           = new GridLength();
                definition.SharedSizeGroup = column.Header.Replace(" ", "");
                break;

            case GridColumnWidthType.Fixed:
                definition.Width = new GridLength(column.Width);
                break;
            }

            return(definition);
        }
Beispiel #3
0
        public MainWindowViewModel()
        {
            Columns = new GridColumnDefinition[] {
                new TextColumnDefinition("Name", FileViewModel.NameProperty, new StringFieldMetadata("Name", 80))
                {
                    IsReadOnly = true, WidthType = GridColumnWidthType.Fill
                },
                new DateColumnDefinition("Modified", FileViewModel.ModifiedProperty, new DateTimeFieldMetadata("Modified"))
                {
                    IsReadOnly = true, Width = 100
                },
                new IntegerColumnDefinition("Size", FileViewModel.SizeProperty, new IntegerFieldMetadata("Size", 0, Int32.MaxValue))
                {
                    IsReadOnly = true, Width = 100
                },
            };

            NewBundleCommand        = new DelegateCommand(CreateBundle);
            OpenBundleCommand       = new DelegateCommand(OpenBundle);
            OpenRecentBundleCommand = new DelegateCommand <string>(OpenBundle);
            MergeFileCommand        = new DelegateCommand(MergeFile);
            MergeDirectoryCommand   = new DelegateCommand(MergeDirectory);
            RenameFolderCommand     = new DelegateCommand <FolderViewModel>(RenameFolder);
            NewFolderCommand        = new DelegateCommand <FolderViewModel>(NewFolder);
            OpenItemCommand         = new DelegateCommand <FileViewModel>(OpenItem);

            RecentFiles = new ObservableCollection <string>();
            Folders     = new ObservableCollection <FolderViewModel>();
            Items       = new ObservableCollection <FileViewModel>();

            Progress = new ProgressFieldViewModel()
            {
                IsEnabled = false
            };

            _backgroundWorkerService = ServiceRepository.Instance.FindService <IBackgroundWorkerService>();
        }