• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ModelItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ModelItem的典型用法代码示例。如果您正苦于以下问题:C# ModelItem类的具体用法?C# ModelItem怎么用?C# ModelItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModelItem类属于命名空间,在下文中一共展示了ModelItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UnregisterObject

 public void UnregisterObject(ModelItem modelItem)
 {
     if (items.Exists((i) => i == modelItem))
     {
         modelItem.Dispose();
     }
 }
开发者ID:peeboo,项目名称:open-media-library,代码行数:7,代码来源:BaseModelItem.cs


示例2: GenerateColumns

        // These methods are not used, but they are very useful when developing the Design experience
#if Development

        /// <summary>
        ///     Adds a default column for each property in the data source
        /// </summary>
        public static void GenerateColumns(ModelItem dataGridModelItem, EditingContext context)
        {
            using (ModelEditingScope scope = dataGridModelItem.BeginEdit(Properties.Resources.Generate_Columns))
            {

                // Set databinding related properties
                DataGridDesignHelper.SparseSetValue(dataGridModelItem.Properties[MyPlatformTypes.DataGrid.AutoGenerateColumnsProperty], false);

                // Get the datasource 
                object dataSource = dataGridModelItem.Properties[MyPlatformTypes.DataGrid.ItemsSourceProperty].ComputedValue;
                if (dataSource != null)
                {

                    foreach (ColumnInfo columnGenerationInfo in DataGridDesignHelper.GetColumnGenerationInfos(dataSource))
                    {

                        ModelItem dataGridColumn = null;

                        dataGridColumn = DataGridDesignHelper.CreateDefaultDataGridColumn(context, columnGenerationInfo);

                        if (dataGridColumn != null)
                        {
                            dataGridModelItem.Properties[MyPlatformTypes.DataGrid.ColumnsProperty].Collection.Add(dataGridColumn);
                        }
                    }
                }
                scope.Complete();
            }
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:35,代码来源:DataGridActions.cs


示例3: RedirectParent

        /// <summary>
        /// Redirect the parent action.
        /// </summary>
        /// <param name="parent">The item being dragged in.</param>
        /// <param name="childType">The type of the item being dragged.</param>
        /// <returns>The new parent for the child.</returns>
        public override ModelItem RedirectParent(ModelItem parent, Type childType)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }

            if (childType == null)
            {
                throw new ArgumentNullException("childType");
            }

            if (parent.Content != null && parent.Content.IsSet)
            {
                // if Expander has a content and if the content is a panel or a contentcontrol, let the content act as the parent
                ModelItem content = parent.Content.Value;
                if (content != null &&
                    (content.IsItemOfType(PlatformTypes.Panel.TypeId) ||
                     content.IsItemOfType(PlatformTypes.ContentControl.TypeId)))
                {
                    return content;
                }
                else
                {
                    _canParent = false;
                    return parent; // Expander has a content already but its neither Panel nor ContentControl.
                }
            }

            // Expander doesnt have any content and now Expander itself acts as the parent
            return base.RedirectParent(parent, childType);
        }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:38,代码来源:ExpanderParentAdapter.cs


示例4: InitializeDefaults

 /// <summary>
 /// Initializes the default values for the ModelItem.
 /// </summary>
 /// <param name="modelItem">The ModelItem.</param>
 public override void InitializeDefaults(ModelItem modelItem)
 {
     if (modelItem == null)
     {
         throw new ArgumentNullException("modelItem");
     }
 }
开发者ID:no10pc,项目名称:PhoneToolkit,代码行数:11,代码来源:PhoneTextBoxDesign.cs


示例5: UpdateIsSelectedForOtherTabs

 /// <summary>
 /// Only one TabItem should have DesignTimeIsSelectedProperty set to true at a time.
 /// DesignTimeSelectedIndexProperty of TabControl should match with that of active tab.
 /// </summary>
 /// <param name="item">The ModelItem representing a TabItem.</param>
 private static void UpdateIsSelectedForOtherTabs(ModelItem item)
 {
     // item.Parent is Tabcontrol
     if (item.Parent != null && item.Parent.IsItemOfType(MyPlatformTypes.TabControl.TypeId))
     {
         if (item.Parent.Content != null)
         {
             ModelItemCollection tabItemCollection = item.Parent.Content.Collection;
             if (tabItemCollection != null && tabItemCollection.Count > 0)
             {
                 foreach (ModelItem tabItem in tabItemCollection)
                 {
                     if (tabItem != item)
                     { 
                         // set designer property for other tabItem in TabControl to false.
                         tabItem.SetDesignerProperty(DesignTimeIsSelectedProperty, false);
                     }
                     else
                     {
                         // This tabItem has been activated, update selectedIndex for Tabcontrol
                         tabItem.Parent.SetDesignerProperty(
                             TabControlDesignModeValueProvider.DesignTimeSelectedIndexProperty, 
                             tabItemCollection.IndexOf(tabItem));
                     }
                 }
             }
         }
     }
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:34,代码来源:TabItemDesignModeValueProvider.cs


示例6: RemoveColumns

 /// <summary>
 ///     Removes all columns from the DataGrid
 /// </summary>
 public static void RemoveColumns(ModelItem dataGridModelItem, EditingContext editingContext)
 {
     using (ModelEditingScope scope = dataGridModelItem.BeginEdit(Properties.Resources.Remove_Columns))
     {
         dataGridModelItem.Properties[MyPlatformTypes.DataGrid.ColumnsProperty].Collection.Clear();
         scope.Complete();
     }
 }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:11,代码来源:DataGridActions.cs


示例7: InitializeDefaults

 // Set any property defaults here
 public override void InitializeDefaults(ModelItem item) 
 {
     if (item != null) 
     {
         DataGridHelper.SparseSetValue(item.Properties["Width"], 180.0);
         DataGridHelper.SparseSetValue(item.Properties["Height"], 170.0);
     }
 }
开发者ID:ericschultz,项目名称:wpftoolkit,代码行数:9,代码来源:Initializers.cs


示例8: InitializeDefaults

 /// <summary>
 /// Sets the default property values for AccordionItem.
 /// </summary>
 /// <param name="item">The AccordionItem ModelItem.</param>
 public override void InitializeDefaults(ModelItem item)
 {
     // <AccordionItem Content="AccordionItem" Header="AccordionItem" />
     string headerName = Extensions.GetMemberName<Silverlight::System.Windows.Controls.AccordionItem>(x => x.Header);
     string contentName = Extensions.GetMemberName<Silverlight::System.Windows.Controls.AccordionItem>(x => x.Content);
     item.Properties[headerName].SetValue(Properties.Resources.AccordionItem_Header);
     item.Properties[contentName].SetValue(Properties.Resources.AccordionItem_Content);
 }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:12,代码来源:AccordionItemDefaultInitializer.cs


示例9: Activate

        protected override void Activate(ModelItem item)
        {
            // Create and add a new adorner panel
            wheelSegmentsPanel = new WheelSegmentAdornerPanel(item);
            Adorners.Add(wheelSegmentsPanel);

            base.Activate(item);
        }
开发者ID:jwhite,项目名称:mangosteen,代码行数:8,代码来源:WheelPanelAdornerProvider.cs


示例10: InitializeDefaults

        /// <summary>
        /// Sets the default property values for Rating. 
        /// </summary>
        /// <param name="item">SSWCDC.Rating ModelItem.</param>
        public override void InitializeDefaults(ModelItem item)
        {
            string propertyName;

            // <inputToolkit:Rating ItemCount="5">
            propertyName = Extensions.GetMemberName<SSWC.Rating>(x => x.ItemCount);
            item.Properties[propertyName].SetValue(5);
        }
开发者ID:modulexcite,项目名称:SilverlightToolkit,代码行数:12,代码来源:RatingDefaultInitializer.cs


示例11: GetModels

 internal static IEnumerable<ModelFile> GetModels(ModelItem m)
 {
     foreach (var a in m.files)
         yield return a;
     foreach (ModelItem a in m.dirs)
         foreach (var b in GetModels(a))
             yield return b;
 }
开发者ID:friuns,项目名称:New-Unity-Project-tm2---Copy,代码行数:8,代码来源:ModelLibrary.cs


示例12: WheelPanelDesignTimeCanvas

        public WheelPanelDesignTimeCanvas(ModelItem item)
        {
            _item = item;

            this.Loaded += WheelSegmentAdornerPanel_Loaded;
            this.SizeChanged += WheelPanelDesignTimeCanvas_SizeChanged;

            item.PropertyChanged += Item_PropertyChanged;
        }
开发者ID:jwhite,项目名称:mangosteen,代码行数:9,代码来源:WheelPanelDesignTimeCanvas.cs


示例13: Activate

        protected override void Activate(ModelItem item, DependencyObject view)
        {
            calendarModelItem = item;

            CreateAdornerPanel();
            PlaceAdornerPanel();
            SubscribeDesignerEvents();

            base.Activate(item, view);
        }
开发者ID:Jalalx,项目名称:FarsiLibrary,代码行数:10,代码来源:MonthViewDesignAdorner.cs


示例14: ModelOperationAdorner

 public ModelOperationAdorner(ModelItem adorned)
     : base(adorned)
 {
     collection = new VisualCollection(this);
     collection.Add(tl = GetResizeThumb("LT"));
     collection.Add(tr = GetResizeThumb("RT"));
     collection.Add(bl = GetResizeThumb("LB"));
     collection.Add(br = GetResizeThumb("RB"));
     collection.Add(handler = GetMoveThumb());
 }
开发者ID:kevinxw,项目名称:CIS681-Pr4,代码行数:10,代码来源:ModelOperationAdorner.cs


示例15: InitializeDefaults

        // Set any property defaults here
        public override void InitializeDefaults(ModelItem item)
        {
            if (item != null)
            {
                DataGridDesignHelper.SparseSetValue(item.Properties[PlatformTypes.DataGrid.WidthProperty], 200.0);
                DataGridDesignHelper.SparseSetValue(item.Properties[PlatformTypes.DataGrid.HeightProperty], 200.0);

                DataGridDesignHelper.SparseSetValue(item.Properties[PlatformTypes.DataGrid.AutoGenerateColumnsProperty], false);
            }
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:11,代码来源:DataGridInitializer.cs


示例16: CreateTemplateColumn

        /// <summary>
        ///     Creates a DataGridTemplateColumn ModelItem with default templates for this property
        /// </summary>
        internal static ModelItem CreateTemplateColumn(EditingContext context, ColumnInfo columnGenerationInfo, ModelItem dataGridColumn)
        {
            ModelItem displayDataTemplate = CreateDataTemplate(context, PlatformTypes.TextBlock.TypeId, PlatformTypes.TextBlock.TextProperty, columnGenerationInfo.PropertyInfo.Name);
            dataGridColumn.Properties[PlatformTypes.DataGridTemplateColumn.CellTemplateProperty].SetValue(displayDataTemplate);

            ModelItem editingDataTemplate = CreateDataTemplate(context, PlatformTypes.TextBox.TypeId, PlatformTypes.TextBox.TextProperty, columnGenerationInfo.PropertyInfo.Name);
            dataGridColumn.Properties[PlatformTypes.DataGridTemplateColumn.CellEditingTemplateProperty].SetValue(editingDataTemplate);

            return dataGridColumn;
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:13,代码来源:DataGridDesignHelper.cs


示例17: InitializeDefaults

 // Set any property defaults here
 public override void InitializeDefaults(ModelItem item) 
 {
     if (item != null) 
     {
         // This will really cause a margin to be added.
         Size defaultsize = new Size(200, 200);
         DataGridHelper.SparseSetValue(item.Properties[FrameworkElement.WidthProperty], defaultsize.Width);
         DataGridHelper.SparseSetValue(item.Properties[FrameworkElement.HeightProperty], defaultsize.Height);
     }
 }
开发者ID:TheJohny,项目名称:wpftoolkit,代码行数:11,代码来源:DataGridInitializer.cs


示例18: InitializeDefaults

        /// <summary>
        /// Initializes default for the specified ModelItem.
        /// </summary>
        /// <param name="item">Specified ModelItem.</param>
        public override void InitializeDefaults(ModelItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            // Set properties
            item.Properties["Header"].SetValue(typeof(MenuItem).Name);
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:14,代码来源:MenuItemDesign.cs


示例19: InitializeDefaults

        /// <summary>
        /// Sets the default property values for GridSplitter. 
        /// </summary>
        /// <param name="item">SSWC.GridSplitter ModelItem.</param>
        public override void InitializeDefaults(ModelItem item)
        {
            string propertyName;

            propertyName = Extensions.GetMemberName<SSWC.GridSplitter>(x => x.Width);
            item.Properties[propertyName].SetValue("10.0");

            propertyName = Extensions.GetMemberName<SSWC.GridSplitter>(x => x.Height);
            item.Properties[propertyName].SetValue("100.0");
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:14,代码来源:GridSplitterDefaultInitializer.cs


示例20: InitializeDefaults

        /// <summary>
        /// TabControl initializer.
        /// </summary>
        /// <param name="item">Model item for a TabControl.</param>
        /// <param name="context">Editing context.</param>
        public override void InitializeDefaults(ModelItem item, EditingContext context)
        {
            // Use SparseSetValue to avoid setting values to their defaults
            Util.SparseSetValue(item.Properties[MyPlatformTypes.FrameworkElement.WidthProperty], 200d);
            Util.SparseSetValue(item.Properties[MyPlatformTypes.FrameworkElement.HeightProperty], 100d);

            // Add a default TabItem
            ModelItem newTabItem = ModelFactory.CreateItem(context, MyPlatformTypes.TabItem.TypeId, CreateOptions.InitializeDefaults);
            item.Content.Collection.Add(newTabItem);
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:15,代码来源:TabControlInitializer.cs



注:本文中的ModelItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ModelMapper类代码示例发布时间:2022-05-24
下一篇:
C# ModelInterfaceExtenders类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap