Skip to content

Instantly share code, notes, and snippets.

@BryanWilhite
Created November 13, 2014 00:57
Show Gist options
  • Save BryanWilhite/164ba9e5aa5516879085 to your computer and use it in GitHub Desktop.
Save BryanWilhite/164ba9e5aa5516879085 to your computer and use it in GitHub Desktop.
C#, Silverlight/Telerik: RadMultiSelectDropDownDataField
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