Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Binding data to dialog

$
0
0

hello,

my VM open a dialog thougth message :

public void AddAssociationCommandExecute()
{
Messenger.Default.Send(new NotificationMessage<DictionaryEntry>(new DictionaryEntry("0", "FALSE"), Notifications.NewAssociationDialog));
}

my mainwindow receive a message and open a dialog:

Messenger.Default.Register<NotificationMessage<DictionaryEntry>>(this, message =>
{
if (message.Notification == Notifications.NewAssociationDialog)
{
AssociationDialog window = new AssociationDialog();
window.DataContext = message.Content;
window.ShowDialog();
}
});

dialog XAML:

<Window x:Class="MONITOR.AssociationDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
        Title="Association" Height="300" Width="300"><Grid><StackPanel Margin="20"><dxe:TextEdit NullText="Key" EditValue="{Binding Key}"/><dxe:TextEdit NullText="Value" EditValue="{Binding Value}"/></StackPanel><Button VerticalAlignment="Bottom" Content="OK" HorizontalAlignment="Right" Margin="20" Click="Button_Click"/></Grid></Window>

In the field Key dialog show 0 and value FALSE, that's ok.

The problem is that I'm modifing this data in dialog, after dialog is close the value are not saved. Why ? Iwant in "message.Content" the modified values.

thanks


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>