本文整理汇总了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();
}
}
示例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();
}
}
示例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);
}
示例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");
}
}
示例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));
}
}
}
}
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例12: WheelPanelDesignTimeCanvas
public WheelPanelDesignTimeCanvas(ModelItem item)
{
_item = item;
this.Loaded += WheelSegmentAdornerPanel_Loaded;
this.SizeChanged += WheelPanelDesignTimeCanvas_SizeChanged;
item.PropertyChanged += Item_PropertyChanged;
}
示例13: Activate
protected override void Activate(ModelItem item, DependencyObject view)
{
calendarModelItem = item;
CreateAdornerPanel();
PlaceAdornerPanel();
SubscribeDesignerEvents();
base.Activate(item, view);
}
示例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());
}
示例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);
}
}