本文整理汇总了C#中System.Windows.Controls.ContentPresenter类的典型用法代码示例。如果您正苦于以下问题:C# ContentPresenter类的具体用法?C# ContentPresenter怎么用?C# ContentPresenter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContentPresenter类属于System.Windows.Controls命名空间,在下文中一共展示了ContentPresenter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WatermarkAdorner
/// <summary>
/// Initializes a new instance of the <see cref="WatermarkAdorner"/> class
/// </summary>
/// <param name="adornedElement"><see cref="UIElement"/> to be adorned</param>
/// <param name="watermark">The watermark</param>
public WatermarkAdorner(UIElement adornedElement, object watermark)
: base(adornedElement)
{
IsHitTestVisible = false;
contentPresenter = new ContentPresenter
{
Content = watermark,
Opacity = 0.5,
Margin = new Thickness(Control.Margin.Left + Control.Padding.Left, Control.Margin.Top + Control.Padding.Top, 0, 0)
};
if (Control is ItemsControl && !(Control is ComboBox))
{
contentPresenter.VerticalAlignment = VerticalAlignment.Center;
contentPresenter.HorizontalAlignment = HorizontalAlignment.Center;
}
// Hide the control adorner when the adorned element is hidden
var binding = new Binding("IsVisible")
{
Source = adornedElement,
Converter = new BooleanToVisibilityConverter()
};
SetBinding(VisibilityProperty, binding);
}
示例2: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_presenter = this.GetTemplateChild("ContentContainer") as ContentPresenter;
SetupZoomRight();
SetupGestureListener(this.GetTemplateChild("ContentBorder"));
}
示例3: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new RepairCompanyListCommand
{
ContentPre = contentPresenter
};
}
示例4: DropPreviewAdorner
/// <summary>
/// Initializes a new instance of the <see cref="DropPreviewAdorner"/> class.
/// </summary>
/// <param name="feedbackUI">The UI element used as feedback element.</param>
/// <param name="adornedElement">The element to bind the adorner to.</param>
public DropPreviewAdorner(UIElement feedbackUI, UIElement adornedElement)
: base(adornedElement)
{
m_Presenter = new ContentPresenter();
m_Presenter.Content = feedbackUI;
m_Presenter.IsHitTestVisible = false;
}
示例5: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new ViewStockRegisterCommand
{
ContentPre = contentPresenter
};
}
示例6: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new CompanyCommand
{
ContentPre = contentPresenter
};
}
示例7: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new DoBankDepositCommand
{
ContentPre = contentPresenter
};
}
示例8: DataTemplateAdorner
public DataTemplateAdorner(object data, UIElement adornedElement, DataTemplate dataTemplate)
: base(adornedElement) {
_contentPresenter = new ContentPresenter() {
Content = data,
ContentTemplate = dataTemplate,
};
}
示例9: UpdateCells
private void UpdateCells()
{
var grid = this.Content as UniformGrid;
int counter = 0;
foreach (Border child in grid.Children)
{
try
{
var cp = new ContentPresenter();
cp.MouseLeftButtonDown += (sender, args) =>
{
UIElement el = (UIElement) sender;
var _point = args.MouseDevice.GetPosition(el);
el.CaptureMouse();
};
cp.Content = board[counter++];
child.Child = cp;
//child.Child = new TextBlock()
//{
// Text = board[counter++].GetType().ToString()
//};
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
return;
}
}
}
示例10: ParseCommand
internal ICommand ParseCommand(string requestedCommand, ContentPresenter contentPresenter)
{
var command = FindRequestedCommand(requestedCommand);
if(command ==null)
return new NotFoundCommand{Name = requestedCommand};
return command.MakeCommand(contentPresenter);
}
示例11: ResizeThumb_DragStarted
private void ResizeThumb_DragStarted(object sender, DragStartedEventArgs e)
{
this.designerItem = this.DataContext as ContentControl;
if (this.designerItem != null)
{
this.canvas = VisualTreeHelper.GetParent(this.designerItem) as ContentPresenter;
if (this.canvas != null)
{
this.transformOrigin = this.designerItem.RenderTransformOrigin;
this.rotateTransform = this.designerItem.RenderTransform as RotateTransform;
if (this.rotateTransform != null)
{
this.angle = this.rotateTransform.Angle * Math.PI / 180.0;
}
else
{
this.angle = 0.0d;
}
AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this.canvas);
if (adornerLayer != null)
{
this.adorner = new SizeAdorner(this.designerItem);
adornerLayer.Add(this.adorner);
}
}
}
}
示例12: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new ViewSupplierBalanceCommand
{
ContentPre = contentPresenter
};
}
示例13: PopupButton
public PopupButton()
{
var content = new ContentPresenter();
content.SetBinding(ContentPresenter.ContentProperty, new Binding("PopupContent") { Source = this });
var border = new Border()
{
CornerRadius = new CornerRadius(5),
BorderThickness = new Thickness(1),
Child = content
};
border.SetResourceReference(Border.BackgroundProperty, "BaseWindowBackgroundBrush");
border.SetResourceReference(Border.BorderBrushProperty, "WindowBorderBrush");
_popup = new Popup()
{
AllowsTransparency = true,
StaysOpen = false,
Placement = PlacementMode.Bottom,
PlacementTarget = this,
DataContext = this,
Child = border,
};
_popup.SetBinding(Popup.IsOpenProperty, "IsChecked");
_popup.SetBinding(Popup.WidthProperty, "Width");
SetBinding(PopupButton.IsHitTestVisibleProperty, new Binding("IsOpen") { Source = _popup, Mode = BindingMode.OneWay, Converter = new InverseBooleanConverter() });
}
示例14: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new ViewCustomerLedgerCommand
{
ContentPre = contentPresenter
};
}
示例15: MakeCommand
public ICommand MakeCommand(ContentPresenter contentPresenter)
{
return new DoBankWithdrawalCommand
{
ContentPre = contentPresenter
};
}