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


C# Controls.ContentPresenter类代码示例

本文整理汇总了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);
        }
开发者ID:Slesa,项目名称:Poseidon,代码行数:31,代码来源:WatermarkAdorner.cs

示例2: OnApplyTemplate

 public override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     _presenter = this.GetTemplateChild("ContentContainer") as ContentPresenter;
     SetupZoomRight();
     SetupGestureListener(this.GetTemplateChild("ContentBorder"));
 }
开发者ID:halllo,项目名称:SilverlightRun,代码行数:7,代码来源:ColdZoomContainer.cs

示例3: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new RepairCompanyListCommand
                {
                    ContentPre = contentPresenter
                };
 }
开发者ID:shuvo009,项目名称:RahamtGroupStore,代码行数:7,代码来源:RepairCompanyListCommand.cs

示例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;
 }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:12,代码来源:DropPreviewAdorner.cs

示例5: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new ViewStockRegisterCommand
     {
         ContentPre = contentPresenter
     };
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:7,代码来源:ViewStockRegisterCommand.cs

示例6: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new CompanyCommand
         {
             ContentPre = contentPresenter
         };
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:7,代码来源:CompanyCommand.cs

示例7: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new DoBankDepositCommand
         {
             ContentPre = contentPresenter
         };
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:7,代码来源:DoBankDepositCommand.cs

示例8: DataTemplateAdorner

		public DataTemplateAdorner(object data, UIElement adornedElement, DataTemplate dataTemplate)
			: base(adornedElement) {
			_contentPresenter = new ContentPresenter() {
				Content = data,
				ContentTemplate = dataTemplate,
			};
		}
开发者ID:RushuiGuan,项目名称:mvvm,代码行数:7,代码来源:DataTemplateAdorner.cs

示例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;
                }

            }
        }
开发者ID:Namolem,项目名称:checkers,代码行数:31,代码来源:ChessBoard.xaml.cs

示例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);
 }
开发者ID:shuvo009,项目名称:RahamtGroupStore,代码行数:7,代码来源:CommandParser.cs

示例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);
                    }
                }
            }
        }
开发者ID:nakioman,项目名称:furryrun-editor,代码行数:31,代码来源:ResizeThumb.cs

示例12: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new ViewSupplierBalanceCommand
         {
             ContentPre = contentPresenter
         };
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:7,代码来源:ViewSupplierBalanceCommand.cs

示例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() });
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:25,代码来源:PopupButton.cs

示例14: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new ViewCustomerLedgerCommand
         {
             ContentPre = contentPresenter
         };
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:7,代码来源:ViewCustomerLedgerCommand.cs

示例15: MakeCommand

 public ICommand MakeCommand(ContentPresenter contentPresenter)
 {
     return new DoBankWithdrawalCommand
         {
             ContentPre = contentPresenter
         };
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:7,代码来源:DoBankWithdrawalCommand.cs


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