mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-04 06:51:28 +08:00
popup支持设置大小
This commit is contained in:
@@ -8,7 +8,8 @@
|
|||||||
<PackageIcon>A.png</PackageIcon>
|
<PackageIcon>A.png</PackageIcon>
|
||||||
<PackageIconUrl />
|
<PackageIconUrl />
|
||||||
<NeutralLanguage />
|
<NeutralLanguage />
|
||||||
<Version>1.1.5</Version>
|
<Version>1.1.5
|
||||||
|
</Version>
|
||||||
<Description>一个Wpf的Diagram控件基础库</Description>
|
<Description>一个Wpf的Diagram控件基础库</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
x:Name="theView">
|
x:Name="theView">
|
||||||
<Grid>
|
<Grid x:Name="grid">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ namespace AIStudio.Wpf.DiagramDesigner.Controls
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Init(double width, double height)
|
||||||
|
{
|
||||||
|
grid.Width = width;
|
||||||
|
grid.Height = height;
|
||||||
|
}
|
||||||
|
|
||||||
private void Ok_Click(object sender, RoutedEventArgs e)
|
private void Ok_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.DialogResult = true;
|
this.DialogResult = true;
|
||||||
|
|||||||
@@ -18,5 +18,12 @@ namespace AIStudio.Wpf.DiagramDesigner.Services
|
|||||||
/// <param name="dataContextForPopup">Object state to associate with the dialog</param>
|
/// <param name="dataContextForPopup">Object state to associate with the dialog</param>
|
||||||
/// <returns>True/False if UI is displayed.</returns>
|
/// <returns>True/False if UI is displayed.</returns>
|
||||||
bool? ShowDialog(object dataContextForPopup);
|
bool? ShowDialog(object dataContextForPopup);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This method displays a modal dialog associated with the given key.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dataContextForPopup">Object state to associate with the dialog</param>
|
||||||
|
/// <returns>True/False if UI is displayed.</returns>
|
||||||
|
bool? ShowDialog(object dataContextForPopup, double width, double height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,20 @@ namespace AIStudio.Wpf.DiagramDesigner.Services
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool? ShowDialog(object dataContextForPopup, double width, double height)
|
||||||
|
{
|
||||||
|
PopupWindow win = new PopupWindow();
|
||||||
|
win.SizeToContent = SizeToContent.Manual;
|
||||||
|
win.Width = width;
|
||||||
|
win.Height = height;
|
||||||
|
win.DataContext = dataContextForPopup;
|
||||||
|
win.Owner = Application.Current.MainWindow;
|
||||||
|
if (win != null)
|
||||||
|
return win.ShowDialog();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user