コード例 #1
0
        /// <summary>
        /// To register design time metadata for DataField.
        /// </summary>
        public DataFieldMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.DataField),
                b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.DataField>(x => x.Height, 28d);
                GenericDefaultInitializer.AddDefault <SSWC.DataField>(x => x.Width, 200d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute("DataSource", Extensions.GetMemberName <SSWC.DataField>(x => x.Content)));
                b.AddCustomAttributes(new DefaultEventAttribute("CurrentItemChanged"));

                // Common
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.Content), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.Description), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.IsRequired), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.Label), new CategoryAttribute(Properties.Resources.CommonProperties));

                // Layout
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.DescriptionViewerPosition), new CategoryAttribute(Properties.Resources.Layout));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.LabelPosition), new CategoryAttribute(Properties.Resources.Layout));

                // Appearance
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.DescriptionViewerVisibility), new CategoryAttribute(Properties.Resources.Appearance));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.LabelVisibility), new CategoryAttribute(Properties.Resources.Appearance));

                // DataFormStyling
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.DescriptionViewerStyle), new CategoryAttribute(Properties.Resources.DataFormStyling));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.LabelStyle), new CategoryAttribute(Properties.Resources.DataFormStyling));

                // DataContextValueSource
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.DescriptionViewerStyle), new DataContextValueSourceAttribute(Extensions.GetMemberName <SSWC.DataField>(x => x.Description), true));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataField>(x => x.LabelStyle), new DataContextValueSourceAttribute(Extensions.GetMemberName <SSWC.DataField>(x => x.Label), true));

                // DefaultPropertyAttribute
                b.AddCustomAttributes(new DefaultPropertyAttribute(Extensions.GetMemberName <SSWC.DataField>(x => x.Label)));

                // ComplexBindingPropertiesAttribute
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(
                                          Extensions.GetMemberName <SSWC.DataField>(x => x.DataContext),
                                          Extensions.GetMemberName <SSWC.DataField>(x => x.PropertyPath)));

                // TypeConverterAttribute
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.DataField>(x => x.Label),
                    new TypeConverterAttribute(typeof(StringConverter)));
            });
        }
コード例 #2
0
        /// <summary>
        /// To register design time metadata for DataPager.
        /// </summary>
        public DataPagerMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.DataPager), b =>
            {
                GenericDefaultInitializer.AddDefault(typeof(SSWC.DataPager), "PageSize", 10);
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                // Common
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataPager>(x => x.PageSize), new CategoryAttribute(Properties.Resources.CommonProperties));
            });
        }
コード例 #3
0
        /// <summary>
        /// To register design time metadata for Page.
        /// </summary>
        public PageMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.Page),
                b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.Page>(x => x.Height, 100d);
                GenericDefaultInitializer.AddDefault <SSWC.Page>(x => x.Width, 200d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(Extensions.GetMemberName <SSWC.Page>(x => x.Title)));
            });
        }
コード例 #4
0
        /// <summary>
        /// To register design time metadata for DescriptionViewer.
        /// </summary>
        public DescriptionViewerMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.DescriptionViewer),
                b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.DescriptionViewer>(x => x.Height, 15d);
                GenericDefaultInitializer.AddDefault <SSWC.DescriptionViewer>(x => x.Width, 15d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute("Target", Extensions.GetMemberName <SSWC.DescriptionViewer>(x => x.PropertyPath)));
                b.AddCustomAttributes(new DefaultPropertyAttribute(Extensions.GetMemberName <SSWC.DescriptionViewer>(x => x.Description)));
            });
        }
コード例 #5
0
        /// <summary>
        /// Provide a place to add custom attributes without creating a AttributeTableBuilder subclass.
        /// </summary>
        /// <param name="builder">The assembly attribute table builder.</param>
        protected override void AddAttributes(AttributeTableBuilder builder)
        {
            builder.AddCallback(
                typeof(SSWC.AutoCompleteBox),
                b =>
            {
                GenericDefaultInitializer.AddDefault <SSWC.AutoCompleteBox>(x => x.Height, 28d);
                GenericDefaultInitializer.AddDefault <SSWC.AutoCompleteBox>(x => x.Width, 120d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.AutoCompleteBox>(x => x.Text)));
                b.AddCustomAttributes(new DefaultEventAttribute("SelectionChanged"));
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(
                                          Extensions.GetMemberName <SSWC.AutoCompleteBox>(x => x.ItemsSource),
                                          Extensions.GetMemberName <SSWC.AutoCompleteBox>(x => x.ValueMemberPath)));
            });
        }
コード例 #6
0
        /// <summary>
        /// To register design time metadata for Frame.
        /// </summary>
        public FrameMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.Frame),
                b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.Frame>(x => x.Height, 100d);
                GenericDefaultInitializer.AddDefault <SSWC.Frame>(x => x.Width, 200d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultEventAttribute("Navigated"));
                b.AddCustomAttributes(new DefaultPropertyAttribute("Source"));

                b.AddCustomAttributes(new TypeConverterAttribute(typeof(ExpandableObjectConverter)));
            });
        }
コード例 #7
0
        /// <summary>
        /// To register design time metadata for Label.
        /// </summary>
        public LabelMetadata()
            : base()
        {
            AssemblyName asmName   = typeof(SSWC.ValidationSummary).Assembly.GetName();
            string       labelName = "System.Windows.Controls.Label" + ", " + asmName.FullName;

            AddCallback(
                Type.GetType(labelName),
                b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.Label>(x => x.Height, 28d);
                GenericDefaultInitializer.AddDefault <SSWC.Label>(x => x.Width, 120d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute("Content"));
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute("Target", Extensions.GetMemberName <SSWC.Label>(x => x.PropertyPath)));

                // Common
                b.AddCustomAttributes("IsRequired", new CategoryAttribute(Properties.Resources.CommonProperties));
            });
        }
コード例 #8
0
        /// <summary>
        /// To register design time metadata for ValidationSummary.
        /// </summary>
        public ValidationSummaryMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.ValidationSummary),
                b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.ValidationSummary>(x => x.Height, 100d);
                GenericDefaultInitializer.AddDefault <SSWC.ValidationSummary>(x => x.Width, 120d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(Extensions.GetMemberName <SSWC.ValidationSummary>(x => x.Header)));
                b.AddCustomAttributes(new DefaultEventAttribute("FocusingInvalidControl"));

                // Common
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.ValidationSummary>(x => x.Filter), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.ValidationSummary>(x => x.Target), new CategoryAttribute(Properties.Resources.CommonProperties));

                //TypeConverterAttribute
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.ValidationSummary>(x => x.Header), new TypeConverterAttribute(typeof(StringConverter)));
            });
        }
コード例 #9
0
        /// <summary>
        /// To register design time metadata for DataPager.
        /// </summary>
        public DataPagerMetadata()
            : base()
        {
            AddCallback(
                SilverlightTypes.DataPager, b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault(SilverlightTypes.DataPager, "Height", 26d);
                GenericDefaultInitializer.AddDefault(SilverlightTypes.DataPager, "Width", 200d);
                GenericDefaultInitializer.AddDefault(SilverlightTypes.DataPager, "PageSize", 10);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute("Source"));
                b.AddCustomAttributes(new DefaultEventAttribute("PageIndexChanged"));
                b.AddCustomAttributes(new DefaultPropertyAttribute("Source"));

                // Common
                b.AddCustomAttributes(PlatformTypes.DataPager.PageIndexProperty.Name, new CategoryAttribute(Properties.Resources.CommonProperties));

                // Appearance
                b.AddCustomAttributes(PlatformTypes.DataPager.NumericButtonCountProperty.Name, new CategoryAttribute(Properties.Resources.Appearance));
            });
        }
コード例 #10
0
        protected override void AddAttributes(AttributeTableBuilder builder)
        {
            GenericDefaultInitializer.AddDefault <SSWC.TreeView>(x => x.Height, 200d);
            GenericDefaultInitializer.AddDefault <SSWC.TreeView>(x => x.Width, 120d);

            GenericDefaultInitializer.AddDefault <SSWC.HeaderedItemsControl>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.HeaderedItemsControl>(x => x.Width, 200d);

            GenericDefaultInitializer.AddDefault <SSWC.Calendar>(x => x.Height, 169d);
            GenericDefaultInitializer.AddDefault <SSWC.Calendar>(x => x.Width, 230d);

            GenericDefaultInitializer.AddDefault <SSWC.DatePicker>(x => x.Height, 23d);
            GenericDefaultInitializer.AddDefault <SSWC.DatePicker>(x => x.Width, 120d);

            GenericDefaultInitializer.AddDefault <SSWC.GridSplitter>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.GridSplitter>(x => x.Width, 10d);

            GenericDefaultInitializer.AddDefault <SSWC.TabControl>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.TabControl>(x => x.Width, 200d);

            builder.AddCallback(
                typeof(SSWC.Calendar),
                b =>
            {
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.Calendar>(x => x.SelectedDate)));
                b.AddCustomAttributes(new DefaultEventAttribute("SelectedDatesChanged"));
            });

            builder.AddCallback(
                typeof(SSWCP.CalendarButton),
                b =>
            {
                b.AddCustomAttributes(new ToolboxBrowsableAttribute(false));
                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWCP.CalendarButton>(x => x.Content)));
            });

            builder.AddCallback(
                typeof(SSWCP.CalendarDayButton),
                b =>
            {
                b.AddCustomAttributes(new ToolboxBrowsableAttribute(false));
                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWCP.CalendarDayButton>(x => x.Content)));
            });

            builder.AddCallback(
                typeof(SSWC.DatePicker),
                b =>
            {
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.DatePicker>(x => x.SelectedDate)));
                b.AddCustomAttributes(new DefaultEventAttribute("SelectedDateChanged"));
            });

            builder.AddCallback(
                typeof(SSWCP.DatePickerTextBox),
                b =>
            {
                b.AddCustomAttributes(new ToolboxBrowsableAttribute(false));
                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWCP.DatePickerTextBox>(x => x.Watermark)));
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWCP.DatePickerTextBox>(x => x.Watermark),
                    new TypeConverterAttribute(typeof(StringConverter)));
            });

            builder.AddCallback(
                typeof(SSWC.TabControl),
                b =>
            {
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.TabControl>(x => x.Items)));
                b.AddCustomAttributes(new DefaultEventAttribute("SelectionChanged"));
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(String.Empty, String.Empty));
            });

            builder.AddCallback(
                typeof(SSWC.TabItem),
                b =>
            {
                b.AddCustomAttributes(new ToolboxBrowsableAttribute(false));
                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.TabItem>(x => x.Header)));
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.TabItem>(x => x.Header),
                    new TypeConverterAttribute(typeof(StringConverter)));
            });

            builder.AddCallback(
                typeof(SSWC.TreeView),
                b =>
            {
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.TreeView>(x => x.Items)));
                b.AddCustomAttributes(new DefaultEventAttribute("SelectedItemChanged"));
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(
                                          Extensions.GetMemberName <SSWC.TreeView>(x => x.ItemsSource),
                                          Extensions.GetMemberName <SSWC.TreeView>(x => x.DisplayMemberPath)));
            });

            builder.AddCallback(
                typeof(SSWC.TreeViewItem),
                b =>
            {
                b.AddCustomAttributes(new ToolboxBrowsableAttribute(false));
                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.TreeViewItem>(x => x.Header)));
                b.AddCustomAttributes(new DefaultEventAttribute("Selected"));
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(
                                          Extensions.GetMemberName <SSWC.TreeViewItem>(x => x.ItemsSource),
                                          Extensions.GetMemberName <SSWC.TreeViewItem>(x => x.DisplayMemberPath)));
            });

            builder.AddCallback(
                typeof(SSWC.GridSplitter),
                b =>
            {
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.GridSplitter>(x => x.ShowsPreview)));
                b.AddCustomAttributes(new DefaultEventAttribute("MouseLeftButtonUp"));
            });

            builder.AddCallback(
                typeof(SSWC.HeaderedItemsControl),
                b =>
            {
                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.HeaderedItemsControl>(x => x.Header)));
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(
                                          Extensions.GetMemberName <SSWC.HeaderedItemsControl>(x => x.ItemsSource),
                                          Extensions.GetMemberName <SSWC.HeaderedItemsControl>(x => x.DisplayMemberPath)));
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.HeaderedItemsControl>(x => x.Header),
                    new TypeConverterAttribute(typeof(StringConverter)));
            });

            builder.AddCallback(
                typeof(SSWC.ChildWindow),
                b =>
            {
                b.AddCustomAttributes(new DefaultPropertyAttribute(
                                          Extensions.GetMemberName <SSWC.ChildWindow>(x => x.Title)));
                b.AddCustomAttributes(new DefaultEventAttribute("Closed"));
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.ChildWindow>(x => x.Title),
                    new TypeConverterAttribute(typeof(StringConverter)));
            });

            builder.AddCallback(
                typeof(SSWCP.CalendarItem),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
        }
コード例 #11
0
        /// <summary>
        /// To register design time metadata for DataForm.
        /// </summary>
        public DataFormMetadata()
            : base()
        {
            AddCallback(
                typeof(SSWC.DataForm), b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault <SSWC.DataForm>(x => x.Height, 100d);
                GenericDefaultInitializer.AddDefault <SSWC.DataForm>(x => x.Width, 200d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                // Appearance
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.CommandButtonsVisibility), new CategoryAttribute(Properties.Resources.Appearance));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.HeaderVisibility), new CategoryAttribute(Properties.Resources.Appearance));

                // Common Properties
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.AutoCommit), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.AutoEdit), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.CurrentIndex), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.CurrentItem), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.EditTemplate), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.Header), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.IsReadOnly), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.ItemsSource), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.NewItemTemplate), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.NewItemTemplate), new EditorBrowsableAttribute(EditorBrowsableState.Advanced));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.ReadOnlyTemplate), new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.ReadOnlyTemplate), new EditorBrowsableAttribute(EditorBrowsableState.Advanced));

                // Layout
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.DescriptionViewerPosition), new CategoryAttribute(Properties.Resources.Layout));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.LabelPosition), new CategoryAttribute(Properties.Resources.Layout));

                // DataForm Styling
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.CancelButtonStyle), new CategoryAttribute(Properties.Resources.DataFormStyling));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.CommitButtonStyle), new CategoryAttribute(Properties.Resources.DataFormStyling));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.DataFieldStyle), new CategoryAttribute(Properties.Resources.DataFormStyling));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.ValidationSummaryStyle), new CategoryAttribute(Properties.Resources.DataFormStyling));

                // DataContextValueSource
                string currentItemName = Extensions.GetMemberName <SSWC.DataForm>(x => x.CurrentItem);
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.EditTemplate), new DataContextValueSourceAttribute(currentItemName, true));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.HeaderTemplate), new DataContextValueSourceAttribute(Extensions.GetMemberName <SSWC.DataForm>(x => x.Header), true));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.NewItemTemplate), new DataContextValueSourceAttribute(currentItemName, true));
                b.AddCustomAttributes(Extensions.GetMemberName <SSWC.DataForm>(x => x.ReadOnlyTemplate), new DataContextValueSourceAttribute(currentItemName, true));

                // DefaultPropertyAttribute
                b.AddCustomAttributes(new DefaultPropertyAttribute(Extensions.GetMemberName <SSWC.DataForm>(x => x.ItemsSource)));

                // DefaultEventAttribute
                b.AddCustomAttributes(new DefaultEventAttribute("ItemEditEnded"));

                // ComplexBindingPropertiesAttribute
                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(
                                          Extensions.GetMemberName <SSWC.DataForm>(x => x.ItemsSource)));

                // TypeConverterAttribute
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.DataForm>(x => x.CancelButtonContent),
                    new TypeConverterAttribute(typeof(StringConverter)));
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.DataForm>(x => x.CommitButtonContent),
                    new TypeConverterAttribute(typeof(StringConverter)));
                b.AddCustomAttributes(
                    Extensions.GetMemberName <SSWC.DataForm>(x => x.Header),
                    new TypeConverterAttribute(typeof(StringConverter)));
            });
        }
コード例 #12
0
        /// <summary>
        /// To register design time metadata for DataGrid.
        /// </summary>
        public DataGridMetadata()
            : base()
        {
            AddCallback(
                SilverlightTypes.DataGrid, b =>
            {
                // Defaults
                GenericDefaultInitializer.AddDefault(SilverlightTypes.DataGrid, "Height", 100d);
                GenericDefaultInitializer.AddDefault(SilverlightTypes.DataGrid, "Width", 120d);

                b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer)));

                b.AddCustomAttributes(new ComplexBindingPropertiesAttribute(PlatformTypes.DataGrid.ItemsSourceProperty.Name));
                b.AddCustomAttributes(new DefaultEventAttribute("SelectionChanged"));
                b.AddCustomAttributes(new DefaultPropertyAttribute(PlatformTypes.DataGrid.ColumnsProperty.Name));

                // Appearance
                b.AddCustomAttributes(PlatformTypes.DataGrid.HorizontalScrollBarVisibilityProperty.Name, new CategoryAttribute(Properties.Resources.Appearance));
                b.AddCustomAttributes(PlatformTypes.DataGrid.VerticalScrollBarVisibilityProperty.Name, new CategoryAttribute(Properties.Resources.Appearance));
                b.AddCustomAttributes(PlatformTypes.DataGrid.GridLinesVisibilityProperty.Name, new CategoryAttribute(Properties.Resources.Appearance));
                b.AddCustomAttributes(PlatformTypes.DataGrid.HeadersVisibilityProperty.Name, new CategoryAttribute(Properties.Resources.Appearance));

                // Brushes
                b.AddCustomAttributes(PlatformTypes.DataGrid.HorizontalGridLinesBrushProperty.Name, new CategoryAttribute(Properties.Resources.Brushes));
                b.AddCustomAttributes(PlatformTypes.DataGrid.VerticalGridLinesBrushProperty.Name, new CategoryAttribute(Properties.Resources.Brushes));
                b.AddCustomAttributes(PlatformTypes.DataGrid.AlternatingRowBackgroundProperty.Name, new CategoryAttribute(Properties.Resources.Brushes));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowBackgroundProperty.Name, new CategoryAttribute(Properties.Resources.Brushes));

                // Columns
                b.AddCustomAttributes(PlatformTypes.DataGrid.AutoGenerateColumnsProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.CanUserReorderColumnsProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.CanUserResizeColumnsProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.CanUserSortColumnsProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.ColumnWidthProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.ColumnHeaderHeightProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.FrozenColumnCountProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.MaxColumnWidthProperty.Name, new CategoryAttribute(Properties.Resources.Columns));
                b.AddCustomAttributes(PlatformTypes.DataGrid.MinColumnWidthProperty.Name, new CategoryAttribute(Properties.Resources.Columns));

                // Common
                b.AddCustomAttributes(PlatformTypes.DataGrid.ColumnsProperty.Name, new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(PlatformTypes.DataGrid.IsReadOnlyProperty.Name, new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(PlatformTypes.DataGrid.ItemsSourceProperty.Name, new CategoryAttribute(Properties.Resources.CommonProperties));
                b.AddCustomAttributes(PlatformTypes.DataGrid.SelectedIndexProperty.Name, new CategoryAttribute(Properties.Resources.CommonProperties));

                // DataGrid Styling
                b.AddCustomAttributes(PlatformTypes.DataGrid.CellStyleProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));
                b.AddCustomAttributes(PlatformTypes.DataGrid.DragIndicatorStyleProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));
                b.AddCustomAttributes(PlatformTypes.DataGrid.DropLocationIndicatorStyleProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));
                b.AddCustomAttributes(PlatformTypes.DataGrid.ColumnHeaderStyleProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowGroupHeaderStylesProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowHeaderStyleProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowStyleProperty.Name, new CategoryAttribute(Properties.Resources.DataGridStyling));

                //Rows
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowHeaderWidthProperty.Name, new CategoryAttribute(Properties.Resources.Rows));
                b.AddCustomAttributes(PlatformTypes.DataGrid.AreRowDetailsFrozenProperty.Name, new CategoryAttribute(Properties.Resources.Rows));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowDetailsTemplateProperty.Name, new CategoryAttribute(Properties.Resources.Rows));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowDetailsVisibilityModeProperty.Name, new CategoryAttribute(Properties.Resources.Rows));
                b.AddCustomAttributes(PlatformTypes.DataGrid.RowHeightProperty.Name, new CategoryAttribute(Properties.Resources.Rows));

                // Browsable Attribute
                b.AddCustomAttributes(PlatformTypes.DataGrid.SelectedItemProperty.Name, BrowsableAttribute.No);
                b.AddCustomAttributes(PlatformTypes.DataGrid.CurrentColumnProperty.Name, BrowsableAttribute.No);

                // MenuActions
                b.AddCustomAttributes(new FeatureAttribute(typeof(DataGridMenuProvider)));

                // When it is created from the toolbox
                b.AddCustomAttributes(new FeatureAttribute(typeof(DataGridInitializer)));

#if MWD40
                b.AddCustomAttributes(
                    PlatformTypes.DataGrid.RowDetailsTemplateProperty.Name,
                    new DataContextValueSourceAttribute(
                        PlatformTypes.DataGrid.ItemsSourceProperty.Name,
                        true));
                b.AddCustomAttributes(
                    PlatformTypes.DataGrid.SelectedItemProperty.Name,
                    new DataContextValueSourceAttribute(
                        PlatformTypes.DataGrid.ItemsSourceProperty.Name,
                        true));
                b.AddCustomAttributes(
                    PlatformTypes.DataGrid.RowStyleProperty.Name,
                    new DataContextValueSourceAttribute(
                        PlatformTypes.DataGrid.ItemsSourceProperty.Name,
                        true));
                b.AddCustomAttributes(
                    PlatformTypes.DataGrid.CellStyleProperty.Name,
                    new DataContextValueSourceAttribute(
                        PlatformTypes.DataGrid.ItemsSourceProperty.Name,
                        true));
#endif
            });
        }
コード例 #13
0
        protected override void AddAttributes(AttributeTableBuilder builder)
        {
            GenericDefaultInitializer.SetAction(
                typeof(SSWC.Expander),
                (modelitem, context) =>
            {
                ModelItem newGrid = ModelFactory.CreateItem(context, typeof(SSWC.Grid), CreateOptions.InitializeDefaults);
                newGrid.Properties["Height"].SetValue(Double.NaN);
                newGrid.Properties["Width"].SetValue(Double.NaN);
                newGrid.Properties["HorizontalAlignment"].SetValue(SSW.HorizontalAlignment.Stretch);
                newGrid.Properties["VerticalAlignment"].SetValue(SSW.VerticalAlignment.Stretch);
                modelitem.Content.SetValue(newGrid);
            });

            GenericDefaultInitializer.AddDefault <SSWC.WrapPanel>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.WrapPanel>(x => x.Width, 200d);

            GenericDefaultInitializer.AddDefault <SSWC.Expander>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.Expander>(x => x.Width, 150d);

            GenericDefaultInitializer.SetAction(
                typeof(SSWC.HeaderedContentControl),
                (modelitem, context) =>
            {
                ModelItem newGrid = ModelFactory.CreateItem(context, typeof(SSWC.Grid), CreateOptions.InitializeDefaults);
                newGrid.Properties["Height"].SetValue(Double.NaN);
                newGrid.Properties["Width"].SetValue(Double.NaN);
                newGrid.Properties["HorizontalAlignment"].SetValue(SSW.HorizontalAlignment.Stretch);
                newGrid.Properties["VerticalAlignment"].SetValue(SSW.VerticalAlignment.Stretch);
                modelitem.Content.SetValue(newGrid);
            });

            GenericDefaultInitializer.AddDefault <SSWC.HeaderedContentControl>(x => x.Height, 16d);
            GenericDefaultInitializer.AddDefault <SSWC.HeaderedContentControl>(x => x.Width, 120d);

            builder.AddCallback(
                typeof(SSWC.HeaderedContentControl),
                b => b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer))));
            builder.AddCallback(
                typeof(SSWC.WrapPanel),
                b => b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer))));
            builder.AddCallback(
                typeof(SSWC.Expander),
                b => b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer))));

            builder.AddCallback(
                typeof(SSWCP.GlobalCalendarButton),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(SSWCP.GlobalCalendarDayButton),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(SSWCP.GlobalCalendarItem),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));

            builder.AddCallback(
                typeof(SSWC.TreeViewItemCheckBox),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));

            builder.AddCallback(
                typeof(SSWC.ListBoxDragDropTarget),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(SSWC.TreeViewDragDropTarget),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
        }