修改ContextDialog对话框内容区域的MaxWidth和MaxHeight
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
</ui:ContentDialog.Resources>
|
||||
|
||||
<Grid Width="480"
|
||||
<Grid
|
||||
Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
|
||||
@@ -1,25 +1,33 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using DMS.Core.Helper;
|
||||
using DMS.WPF.Helper;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using iNKORE.UI.WPF.Helpers;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.Dialogs;
|
||||
|
||||
public partial class DeviceDialog
|
||||
public partial class DeviceDialog : ContentDialog
|
||||
{
|
||||
private const int ContentAreaMaxWidth = 1000;
|
||||
private const int ContentAreaMaxHeight = 800;
|
||||
|
||||
public DeviceDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Opened += OnOpened;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
|
||||
{
|
||||
//<2F>ĶԻ<C4B6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
||||
var backgroundElementBorder = VisualTreeFinder.FindVisualChildByName<Border>(this, "BackgroundElement");
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxWidth;
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxHeight;
|
||||
|
||||
// Log the ProtocolType value
|
||||
// if (viewModel.Device != null)
|
||||
// {
|
||||
// NlogHelper.Info($"DeviceDialog opened. Device ProtocolType: {viewModel.Device.ProtocolType}");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NlogHelper.Info("DeviceDialog opened. Device is null.");
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,8 +7,7 @@
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||
xmlns:en="clr-namespace:DMS.Core.Enums"
|
||||
xmlns:sockets="clr-namespace:System.Net.Sockets;assembly=System.Net.Sockets"
|
||||
xmlns:en="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:enums="clr-namespace:DMS.Core.Enums;assembly=DMS.Core"
|
||||
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
@@ -17,7 +16,6 @@
|
||||
DefaultButton="Primary"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
Background="#fff"
|
||||
|
||||
d:DataContext="{d:DesignInstance vmd:VariableDialogViewModel}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -38,7 +36,6 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 基本信息 -->
|
||||
@@ -61,7 +58,7 @@
|
||||
Style="{StaticResource TextBlockSubTitle}" />
|
||||
<ComboBox SelectedValue="{Binding Variable.Protocol, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedValuePath="Tag"
|
||||
ItemsSource="{ex:EnumBindingSource {x:Type sockets:ProtocolType}}">
|
||||
ItemsSource="{ex:EnumBindingSource {x:Type en:ProtocolType}}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource EnumDescriptionConverter}}" />
|
||||
@@ -137,9 +134,5 @@
|
||||
</GroupBox>
|
||||
</ikw:SimpleStackPanel>
|
||||
|
||||
<ikw:SimpleStackPanel Grid.Row="0" Grid.Column="2" Width="100">
|
||||
|
||||
</ikw:SimpleStackPanel>
|
||||
|
||||
</Grid>
|
||||
</ui:ContentDialog>
|
||||
@@ -1,14 +1,27 @@
|
||||
using DMS.WPF.Helper;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.Dialogs;
|
||||
|
||||
public partial class VariableDialog
|
||||
{
|
||||
private const int ContentAreaMaxWidth = 1000;
|
||||
private const int ContentAreaMaxHeight = 800;
|
||||
public VariableDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Opened += OnOpened;
|
||||
}
|
||||
|
||||
private void OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
|
||||
{
|
||||
//<2F>ĶԻ<C4B6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
|
||||
var backgroundElementBorder = VisualTreeFinder.FindVisualChildByName<Border>(this, "BackgroundElement");
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxWidth;
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxHeight;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user