Olá,Drausio
Eu consegui resolver o problema fazendo um Extender, veja o exemplo.
XAML
<UserControl x:Class="Silver.combo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Teste"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.Resources>
<local:CBXExtender x:Key="CBXExtender" />
</Grid.Resources>
<ComboBox Height="30" HorizontalAlignment="Left" Margin="60,52,0,0" Name="cbx" VerticalAlignment="Top" Width="120" >
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Nome}" Margin="5" />
<Border x:Name="bdaCampanha" Width="16" Height="16" Visibility="{Binding Nome, Converter={StaticResource CBXExtender}}" Background="Yellow">
<TextBlock Text="C"></TextBlock>
</Border>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</UserControl>
CODE CLASS TESTE
namespace Teste
{
public class CBXExtender: System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value.ToString() == "Joaquim")
return "Collapsed";
else
return "Visible";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException("ConverBack should never be called");
}
}
}
Américo Arvani
MCP Frw web 2.0 / MCPD (Enterprise Application Developer) Frw web/win/wcf 3.5
MBA – Post Graduate in Strategic Management of Information Technology
Se funcionou compartilhe a solução.
http://americoarvani.blogspot.com