|
#region NameSpace Improts
using System;
using Microsoft.Windows.Design.Interaction;
using System.Windows.Media;
using Microsoft.Windows.Design.Model;
using System.Windows.Controls;
#endregion
namespace Creatives.Design.Surface
{
/// <summary>
/// Defines a <see cref="SurfacePanel"/>.
/// </summary>
internal class SurfacePanel : AdornerPanel
{
#region Ctor
public SurfacePanel(ModelItem modelItem, DesignerVerbCollection verbs)
: base()
{
_verbs = verbs;
_modelItem = modelItem;
IsContentFocusable = true;
}
#endregion
#region Properties
private ModelItem _modelItem;
private DesignerVerbCollection _verbs;
private PropertyGrid _propertyGrid = null;
public ModelItem ModelItem
{
get { return _modelItem; }
}
public DesignerVerbCollection Verbs
{
get { return _verbs; }
}
internal PropertyGrid PropertyGrid
{
get
{
if (_propertyGrid == null)
{
_propertyGrid = new PropertyGrid(ModelItem, Verbs);
InitPropertyGrid();
}
return _propertyGrid;
}
}
#endregion
#region Implementation
private void InitPropertyGrid()
{
this.Children.Add(_propertyGrid);
/* Positions the property grid to the right by 5 pixels */
AdornerPanel.SetAdornerHorizontalAlignment(PropertyGrid, AdornerHorizontalAlignment.OutsideRight);
AdornerPanel.SetAdornerVerticalAlignment(PropertyGrid, AdornerVerticalAlignment.Top);
AdornerPanel.SetAdornerMargin(PropertyGrid, new System.Windows.Thickness(0, 0, 5, 5));
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.