Created
November 13, 2014 00:57
-
-
Save BryanWilhite/164ba9e5aa5516879085 to your computer and use it in GitHub Desktop.
C#, Silverlight/Telerik: RadMultiSelectDropDownDataField
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows.Controls; | |
using GalaSoft.MvvmLight.Messaging; | |
using Telerik.Windows.Controls; | |
namespace Fox.Xavier.Client.Views | |
{ | |
using Fox.Silverlight.Controls; | |
using Fox.Silverlight.Models; | |
public class RadMultiSelectDropDownDataField : DataFormDataField | |
{ | |
protected override Control GetControl() | |
{ | |
var dropdown = new MultiSelectDropDown | |
{ | |
DisplayMemberPath = "DisplayText", | |
DropDownSummaryFormat = "{0} departments selected", | |
SelectedValuePath = "Id" | |
}; | |
if (this.Tag == null) throw new NullReferenceException("The expected Tag is not here."); | |
var content = new LightContentForFrameworkElement<MultiSelectDropDown> | |
{ | |
Element = dropdown, | |
DataOfContext = this.DataContext | |
}; | |
var message = new LightMessage<LightContentForFrameworkElement<MultiSelectDropDown>>(content) | |
{ | |
Source = LightMessageSource.ViewAddedChildren, | |
UniqueId = this.Tag.ToString() | |
}; | |
Messenger.Default.Send(message); | |
return dropdown; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment