我最近遇到了为我的wpf应用程序创建添加和编辑对话框的问题.
我想在代码中做的就是这样.(我主要使用viewmodel第一种方法与mvvm)
调用对话框窗口的ViewModel:
var result = this.uiDialogService.ShowDialog("Dialogwindow Title", dialogwindowVM);
// Do anything with the dialog result
Run Code Online (Sandbox Code Playgroud)
它是如何工作的?
首先,我创建了一个对话服务:
public interface IUIWindowDialogService
{
bool? ShowDialog(string title, object datacontext);
}
public class WpfUIWindowDialogService : IUIWindowDialogService
{
public bool? ShowDialog(string title, object datacontext)
{
var win = new WindowDialog();
win.Title = title;
win.DataContext = datacontext;
return win.ShowDialog();
}
}
Run Code Online (Sandbox Code Playgroud)
WindowDialog是一个特殊而简单的窗口.我需要它来保留我的内容:
<Window x:Class="WindowDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="WindowDialog"
WindowStyle="SingleBorderWindow"
WindowStartupLocation="CenterOwner" SizeToContent="WidthAndHeight">
<ContentPresenter x:Name="DialogPresenter" Content="{Binding .}">
</ContentPresenter>
</Window>
Run Code Online (Sandbox Code Playgroud)
wpf中对话框的问题是dialogresult = true只能在代码中实现.这就是为什么我为我dialogviewmodel实现它的界面.
public class …Run Code Online (Sandbox Code Playgroud) 我有这个 ContentView 有两个不同的模式视图,所以我sheet(isPresented:)同时使用这两个视图,但似乎只有最后一个被呈现。我怎么能解决这个问题?或者无法在 SwiftUI 的视图上使用多个工作表?
struct ContentView: View {
@State private var firstIsPresented = false
@State private var secondIsPresented = false
var body: some View {
NavigationView {
VStack(spacing: 20) {
Button("First modal view") {
self.firstIsPresented.toggle()
}
Button ("Second modal view") {
self.secondIsPresented.toggle()
}
}
.navigationBarTitle(Text("Multiple modal view problem"), displayMode: .inline)
.sheet(isPresented: $firstIsPresented) {
Text("First modal view")
}
.sheet(isPresented: $secondIsPresented) {
Text("Only the second modal view works!")
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码编译时没有警告(Xcode 11.2.1)。
我正在WPF中编写我的第一个应用程序,并希望用户在模式对话框窗口中输入一些数据.显然,这在WPF中并不简单,因为父窗口保持完全启用,并且创建新子窗口的方法不会停止并等待子窗口调用Close().相反,它只是继续前进.这不是我想要的.
如何在父窗口继续执行之前让子窗口打开,让父窗口等待子窗口关闭?
我试图找到一些关于如何在Angular 2.0中进行确认模式对话框的示例.我一直在使用Angular 1.0的Bootstrap对话框,无法在Web上找到Angular 2.0的任何示例.我也检查了角度2.0文档没有运气.
有没有办法在Angular 2.0中使用Bootstrap对话框?
谢谢!
是否有可能在ViewController类中检查它是否显示为模态视图控制器?
我有一个Modal绝对定位的CSS类,z-indexed在它的父级之上,并且很好地定位于JQuery.我想在模式框的顶部添加插入符号图像(^),并且正在使用:beforeCSS伪选择器来干净地执行此操作.
图像需要绝对定位并在模态上方进行z索引,但我没有找到任何方法将相应的类添加到content属性中的图像:
.Modal:before{
content:url('blackCarrot.png') /* with class ModalCarrot ??*/
}
.ModalCarrot{
position:absolute;
left:50%;
margin-left:-8px;
top:-16px;
}
Run Code Online (Sandbox Code Playgroud)
第二个最佳选择 - 我可以在内容属性中添加内联样式吗?
我已经设置了一个带有表单的bootstrap模式,我只是注意到当我按下Enter键时,模态被解除了.按Enter键有没有办法不解雇它?
我尝试用键盘激活模态:false,但这只能阻止使用ESC键解雇.
我需要在模态打开时进行验证,因为如果我打开它,然后我关闭它,并且我按下打开模态的按钮它不起作用,因为它正在进行jquery验证,但不是显示因为模态被解雇了.
所以我想广告一个jquery如果模态是开放的,所以我确实,这可能吗?
<script>
$(document).ready(function(){
var validator =$('#form1').validate(
{
ignore: "",
rules: {
usu_login: {
required: true
},
usu_password: {
required: true
},
usu_email: {
required: true
},
usu_nombre1: {
required: true
},
usu_apellido1: {
required: true
},
usu_fecha_nac: {
required: true
},
usu_cedula: {
required: true
},
usu_telefono1: {
required: true
},
rol_id: {
required: true
},
dependencia_id: {
required: true
},
},
highlight: function(element) {
$(element).closest('.grupo').addClass('has-error');
if($(".tab-content").find("div.tab-pane.active:has(div.has-error)").length == 0)
{
$(".tab-content").find("div.tab-pane:hidden:has(div.has-error)").each(function(index, tab)
{
var id = $(tab).attr("id");
$('a[href="#' + …Run Code Online (Sandbox Code Playgroud) 当你使用jquery UI对话框时,一切都很好,除了一件事.当浏览器调整大小时,对话框只会保持在初始位置,这可能非常烦人.
你可以测试一下:http: //jqueryui.com/demos/dialog/
单击"模态对话框"示例并调整浏览器的大小.
我希望能够在浏览器调整大小时让对话框自动居中.这可以在我的应用程序中以有效的方式完成我的所有对话吗?
非常感谢!
我一直在收到这个错误,因为我正在尝试实现bootstrap Modal窗口.可能是什么原因造成的?我在http://angular-ui.github.io/bootstrap/#/modal复制/粘贴了所有内容.
modal-dialog ×10
.net ×2
jquery ×2
wpf ×2
angular ×1
angularjs ×1
c# ×1
controller ×1
css ×1
dialog ×1
forms ×1
ios ×1
iphone ×1
javascript ×1
jquery-ui ×1
mvvm ×1
swift ×1
swiftui ×1
validation ×1
view ×1