Avoid binding to IEnumerable in MessageBoxView

According to dotMemory, this can cause a memory leak
This commit is contained in:
Antony Male 2015-03-16 13:02:56 +00:00
parent 0e48896a6d
commit 63a9c4a70f
1 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ namespace Stylet
this.DisplayName = caption;
this.Icon = icon;
var buttonList = new List<LabelledValue<MessageBoxResult>>();
var buttonList = new BindableCollection<LabelledValue<MessageBoxResult>>();
this.ButtonList = buttonList;
foreach (var val in ButtonToResults[buttons])
{
@ -165,7 +165,7 @@ namespace Stylet
/// <summary>
/// Gets or sets the list of buttons which are shown in the View.
/// </summary>
public IEnumerable<LabelledValue<MessageBoxResult>> ButtonList { get; protected set; }
public IObservableCollection<LabelledValue<MessageBoxResult>> ButtonList { get; protected set; }
/// <summary>
/// Gets or sets the item in ButtonList which is the Default button