void button_clicked(object sender, RoutedEventArgs e)
 {
     var b = (Button) sender;
     var selectedb = (DistributrMessageBoxButton)b.Tag;
     _clickedButton = bhelper.MessageBoxButtonItem(selectedb);
     this.Close();
 }
 public  DistributrMessageBoxItem  MessageBoxButtonItem(DistributrMessageBoxButton b)
 {
    var btn= item.FirstOrDefault(s => s.Button == b);
    if (btn==null)
    {
        btn = new DistributrMessageBoxItem
                  {
                      Button = DistributrMessageBoxButton.None,
                      ButtonText = "None",
                      Url = @"\Views\HomeViews\Home.xaml",
                      ButtonToolTip = "None"
                  };
    }
     return btn;
 }
        public DistributrMessageBoxResult ShowBox(List<DistributrMessageBoxButton> items, string text, string messageBoxTitle = "Distributr Message Box")
        {
           
            this.Title = messageBoxTitle;
            TextBlockMessage.Text = text;
            int count = 1;
            foreach (DistributrMessageBoxButton s in items)
            {
                 var bdetails = bhelper.MessageBoxButtonItem(s);
               
                Button b = new Button();
                b.Content = bdetails.ButtonText;
                b.Width = (bdetails.ButtonText.Length * 8) ;
                b.Margin = new Thickness(3, 0, 3, 0);
                b.Tag = s;
                b.Click += button_clicked;
                ButtonContainer.Children.Add(b);
                if (count == 1)
                {
                    _clickedButton = bdetails;
                }
                count++;
            }
            this.Owner = Application.Current.MainWindow;
            this.ShowDialog();
            var result = new DistributrMessageBoxResult();
            if (_clickedButton != null)
            {
                result.Url = _clickedButton.Url;
                result.Button = _clickedButton.Button;
            }
            else
            {
                var defaultb = bhelper.MessageBoxButtonItem(DistributrMessageBoxButton.None);
                result.Url = defaultb.Url;
                result.Button = defaultb.Button;
            }


            return result;
        }