or
<DataTemplate x:Key=
"MultiComboBoxView"
>
<telerik:RadComboBox ItemsSource=
"{Binding ValueEnum}"
Width=
"220"
Height=
"30"
ItemTemplate=
"{StaticResource RadComboBoxItemTemplate}"
>
<telerik:RadComboBox.SelectionBoxTemplate>
<DataTemplate>
<TextBlock Text=
"{Binding SelectedItemsText}"
/>
</DataTemplate>
</telerik:RadComboBox.SelectionBoxTemplate>
</telerik:RadComboBox>
</DataTemplate>
private void ListBoxIssue_OnPreviewDrop(object sender, DragEventArgs e)
{
var droppedObject = DragDropPayloadManager.GetDataFromObject(e.Data, typeof(CommsItem));
List<
CommsItem
> listCommsItem = ((List<
object
>) droppedObject).Cast<
CommsItem
>().ToList();
//droppedObject is an object, which is of List<
Object
>, which the objects in the list are CommsItem
foreach (CommsItem commsItem in listCommsItem)
{
if (commsItem.Serial == "2008")
{
e.Handled = true;
e.Effects = DragDropEffects.None;
}
else
{
e.Handled = false;
e.Effects = DragDropEffects.All;
}
}
}
Hi,
The scenario is as follows:
The ViewModel exposes an ObservableCollection of ViewModels
The View has a RadTileList with AutoGenerateTiles=true and Wiring up the AutoGeneratingTile event to set the background color of the Tiles
The Tiles are created dynamically by using DataTemplates based on the type of the ViewModel of the collection of ViewModels exposed by the View's ViewModel
The TileType is bound as every VM in the exposed collection has this property as well.
<
tiles:TscTileList
x:Name
=
"HomeTileList"
ItemsSource
=
"{Binding TileListContentControls, Mode=OneWay}"
SelectedItem
=
"{Binding SelectedTileListContentControl, Mode=TwoWay}"
ScrollViewer.HorizontalScrollBarVisibility
=
"Auto"
AutoGenerateTile
=
"True"
AutoGeneratingTile
=
"HomeTileListAutoGeneratingTile"
>
<
tiles:TscTileList.Resources
>
<
DataTemplate
DataType
=
"{x:Type home:TileListTileContentControlViewModel}"
>
<
tiles:TscTile
Title
=
"{Binding NavigationItem.Name}"
Image
=
"{Binding NavigationItem.Image}"
TileType
=
"{Binding TileType}"
Style
=
"{StaticResource SimpleTileStyle}"
/>
</
DataTemplate
>
<
DataTemplate
DataType
=
"{x:Type home:AboutTargetWidgetTileListContentControlViewModel}"
>
<
tiles:TscTile
Title
=
"{Binding NavigationItem.Name}"
Image
=
"{Binding NavigationItem.Image}"
TileType
=
"{Binding TileType}"
Style
=
"{StaticResource AboutTheTargetWidgetStyle}"
/>
</
DataTemplate
>
</
tiles:TscTileList.Resources
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"SelectionChanged"
>
<
command:EventToCommand
Command
=
"{Binding TileSelectedCommand}"
CommandParameter
=
"{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem}"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
</
tiles:TscTileList
>