1
웹 페이지에서 작업 할 때 많이 사용했습니다. WPF 프로젝트를위한 페이지를 빌드하는 동안 다른 날에 나는 페이지에 대화 상자가있는 것처럼 보이는 페이지를 만들었지 만 페이지의 유일한 것이 었습니다.wpf 인 페이지 대화
내 질문에 대한 답변입니다. 이러한 종류의 대화 상자를 쉽게 만들 수있는 구성 요소를 만든 사람이 있습니까?
웹 페이지에서 작업 할 때 많이 사용했습니다. WPF 프로젝트를위한 페이지를 빌드하는 동안 다른 날에 나는 페이지에 대화 상자가있는 것처럼 보이는 페이지를 만들었지 만 페이지의 유일한 것이 었습니다.wpf 인 페이지 대화
내 질문에 대한 답변입니다. 이러한 종류의 대화 상자를 쉽게 만들 수있는 구성 요소를 만든 사람이 있습니까?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
namespace xxx.Wpf
{
/// <summary>
/// Interaction logic for InPageDialog.xaml
/// </summary>
public partial class InPageDialog : UserControl, INotifyPropertyChanged
{
public InPageDialog()
{
InitializeComponent();
}
public void Show(IDialog ucContent)
{
}
void ucContent_OnClose(object obj)
{
}
protected virtual void Changed(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
public static readonly DependencyProperty ContentBackgroundProperty = DependencyProperty.Register("ContentBackground", typeof(Brush), typeof(InPageDialog), new UIPropertyMetadata(Brushes.White));
public Brush ContentBackground
{
get { return (Brush)GetValue(ContentBackgroundProperty); }
set { SetValue(ContentBackgroundProperty, value); }
}
public static readonly DependencyProperty ContentBorderBrushProperty = DependencyProperty.Register("ContentBorderBrush", typeof(Brush), typeof(InPageDialog), new UIPropertyMetadata(Brushes.White));
public Brush ContentBorderBrush
{
get { return (Brush)GetValue(ContentBorderBrushProperty); }
set { SetValue(ContentBorderBrushProperty, value); }
}
public static readonly DependencyProperty ContentActiveBackgroundProperty = DependencyProperty.Register("ContentActiveBackground", typeof(Brush), typeof(InPageDialog), new UIPropertyMetadata(Brushes.White));
public Brush ContentActiveBackground
{
get { return (Brush)GetValue(ContentActiveBackgroundProperty); }
set { SetValue(ContentActiveBackgroundProperty, value); }
}
public static readonly DependencyProperty ContentBorderThicknessProperty = DependencyProperty.Register("ContentBorderThickness", typeof(Thickness), typeof(InPageDialog));
public Thickness ContentBorderThickness
{
get { return (Thickness)GetValue(ContentBorderThicknessProperty); }
set { SetValue(ContentBorderThicknessProperty, value); }
}
public static readonly DependencyProperty ContentBlurRadiusProperty = DependencyProperty.Register("ContentBlurRadius", typeof(double), typeof(InPageDialog));
public double ContentBlurRadius
{
get { return (double)GetValue(ContentBlurRadiusProperty); }
set { SetValue(ContentBlurRadiusProperty, value); }
}
public event PropertyChangedEventHandler PropertyChanged;
}
public interface IDialog
{
event Action<object> OnClose;
}
}
<UserControl x:Class="xxx.Wpf.InPageDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:me="clr-namespace:xxx.Wpf"
Visibility="Collapsed" DataContext="{Binding}">
<UserControl.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="4"/>
<Setter Property="Width" Value="60"/>
</Style>
</UserControl.Resources>
<UserControl.Template>
<ControlTemplate TargetType="{x:Type me:InPageDialog}">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DataContext="{TemplateBinding DataContext}">
<Rectangle HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Opacity="0.765"
Fill="{TemplateBinding ContentBackground}" />
<Border VerticalAlignment="Center"
HorizontalAlignment="Center"
CornerRadius="5"
BorderBrush="{TemplateBinding ContentBorderBrush}"
BorderThickness="{TemplateBinding ContentBorderThickness}"
Background="{TemplateBinding ContentActiveBackground}" >
<ContentPresenter Margin="0" Width="Auto" Height="Auto" Content="{TemplateBinding Content}" />
</Border>
</Grid>
</ControlTemplate>
</UserControl.Template>
</UserControl>
프로젝트 시작일부터 시작하여 우리가하는 일에 도움이됩니다.
나는 지금도 몇 군데에서 내 자신을 개발했으며 더 일관된 방식으로이 일을하기위한 자원이 있어야 할 것으로 보인다. 나는 아무것도 찾으면 다시보고 할게. – jpierson