当前位置: 首页>>代码示例>>C#>>正文


C# ModelItem类代码示例

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


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


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