Hi,
I am still rather new to WPF in general but trying to come up to speed. I am using RadTileList in an app. I am using it for "recent items" in an application. Those items point to different modules. These modules are color coded. So when the tile renders, I want to select a particular background color of the tile, e.g. Employees = green, Crm = blue, etc.
I am using ItemsSource to a view model property
Here is the main radTileList
<telerik:RadTileList
CanUserSelect="False"
x:Name="HomeTileList"
ItemsSource="{Binding Path=RecentItems}"
GroupTemplate="{StaticResource GroupTemplate}"
Margin="5,5,0,0"
TileReorderMode="None"
ScrollViewer.HorizontalScrollBarVisibility="Auto">
....
I put in this style
<Style TargetType="telerik:Tile" >
<Setter Property="TileType" Value="Single" />
<Setter Property="Group" Value="{StaticResource tgRecent}" />
<!--<Setter Property="Background" Value="{Binding ModuleCode, Converter={StaticResource StringToTileBackgroundConverter}}"/>-->
<Setter Property="Background" Value="{StaticResource ModuleSolicitation}" />
<Setter Property="Background" Value="Black" />
<Style.Triggers>
<DataTrigger Binding="{Binding EntityId}" Value="1">
<Setter Property="Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
I have tried a value converter and a dataTrigger. In the current form, the app picks up the "black" background, but it does not seem to be checking against the EntityId field to render a Red tile.
Note: I eventually want to tied the background color based on the ModuleCode which is an enum. But I am doing EntityId for testing so that that I can have 1=1 so to speak while I figure this out.
this is "RecentItems" as the collection from the dataContext of the view.
public ObservableCollection<RecentItemViewModel> RecentItems { get; private set; }
and here is the class
public class RecentItemViewModel : ViewModelBase
{
private int _entityId;
private string _entityName;
private Enums.Module _moduleCode;
public int EntityId
{
get { return _entityId; }
set
{
if ((_entityId != value))
{
_entityId = value;
RaisePropertyChanged("EntityId");
}
}
}
public string EntityName
{
get { return _entityName; }
set
{
if ((_entityName != value))
{
_entityName = value;
RaisePropertyChanged("EntityName");
}
}
}
public Enums.Module ModuleCode
{
get { return _moduleCode; }
set
{
if ((_moduleCode != value))
{
_moduleCode = value;
RaisePropertyChanged("ModuleCode");
}
}
}
}
any ideas?