[英]showdialog - wpf image does not change in mainwindow
In my mainWindow bitmap change (set new source) works fine. 在我的mainWindow位图中,更改(设置新源)工作正常。 But if I create a new window with ShowDialog, all changes affects (eg ListView, Textbox values eg) in the Mainwindow.
但是,如果我使用ShowDialog创建一个新窗口,则所有更改都会影响Mainwindow中的(例如ListView,Textbox值)。
Bitmap (I set the new source) doesn't. 位图(我设置了新来源)没有。 What can I do?
我能做什么?
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(filename, UriKind.Relative);
image.EndInit();
imgError.Source = null;
imgError.Source = image;
In my MainWindow.xaml I use an image: 在我的MainWindow.xaml中,使用图像:
<Image x:Name="imgError" PreviewMouseLeftButtonDown="imgError_PreviewMouseLeftButtonDown" Source="circle_blue_Error.png" Visibility="Visible" Width="50" Height="50" Canvas.Left="10" Canvas.Top="28" />
If an error occurs, a TextBox.Text is set with a number. 如果发生错误,则使用数字设置TextBox.Text。 TextBox_Changed Event set imgError to an other image, a ListView(log) becomes new Item.
TextBox_Changed事件将imgError设置为其他图像,ListView(log)成为新的Item。 Everything works fine.
一切正常。
When I open a new Window in DialogMode (set some parameters) and an error occures (child window is open) Textbox Value and ListView changes, imgError is set but the UI doesn't change. 当我在DialogMode中打开一个新窗口(设置一些参数)并且发生错误(打开子窗口)时,Textbox Value和ListView更改了,imgError被设置了,但UI却没有改变。
SetRoll frmSetRoll = new SetRoll();
//for positioning
frmSetRoll.wndParent = this;
frmSetRoll.ShowDialog();
我发现了问题,TextBox两次获得了值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.