This project is read-only.


Just add the Gat.Controls.MessageBox.dll to your References. No further dependencies are needed.



Gat.Controls.MessageBoxView messageBox = new Gat.Controls.MessageBoxView();
Gat.Controls.MessageBoxViewModel vm = (Gat.Controls.MessageBoxViewModel)messageBox.FindResource("ViewModel");
vm.Show("Message..", "Caption", Gat.Controls.MessageBoxButton.OkCancel, Gat.Controls.MessageBoxImage.Question);

More Customized

Gat.Controls.MessageBoxView messageBox = new Gat.Controls.MessageBoxView();
Gat.Controls.MessageBoxViewModel vm = (Gat.Controls.MessageBoxViewModel)messageBox.FindResource("ViewModel");

vm.Message = "This is a message: MessageMessageMessageMessageMessageMessageMessageMessageMessageMessageMessageMessageMessageMessageMessageMessageEEE";
vm.Ok = "Left";
vm.Cancel = "Right";
vm.Yes= "Top";
vm.No= "Bottom";
vm.OkVisibility = true;
vm.CancelVisibility = true;
vm.YesVisibility = true;
vm.NoVisibility = true;
vm.Image = new BitmapImage(new System.Uri("pack://application:,,,/Image.bmp"));
vm.Caption = "Test Message";

// Center functionality
vm.Position = MessageBoxPosition.CenterOwner;
vm.Owner = this;



Taking result into account

Gat.Controls.MessageBoxResult result = vm.Show();
if(result == Gat.Controls.MessageBoxResult.Ok)

Last edited May 18, 2016 at 11:41 PM by kittof, version 4


andycambo Jan 23, 2017 at 3:45 PM 
Nice project. I've successfully have it added in a WPF application. The only issue I'm having is getting the message box to be in the center.

I've tried the code suggested but get errors:
vm.Position = MessageBoxPosition.CenterOwner; (ERROR: The name 'MessageBoxPosition' does not exist in the current context_
vm.Owner = this; (ERROR: CMP.ViewModel.ActionListViewModel' to 'System.Windows.Window')

I've tried:
vm.Owner = Application.Current.MainWindow;
vm.Position = Gat.Controls.MessageBoxPosition.CenterOwner;

but the box still isn't in the center.

Any ideas?