Нужен выпадающий список который будет отображать только цвет.
<ComboBox
Grid.Row="11"
Grid.Column="2"
Width="Auto"
Height="Auto"
MinWidth="100"
VerticalAlignment="Bottom"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding ColorList}"
SelectedIndex="{Binding ColorSelect}"
SelectedValue="{Binding ColorSelectValue}"
SelectedValuePath="Id"
Text="variable">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Rectangle
Width="16"
Height="16"
Margin="0,2,5,2"
Fill="{Binding Name}" />
<TextBlock Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
ViewModel
private void GetColorId()
{
ColorCollection.Add(new ColorsServices(0, Colors.Black));
ColorCollection.Add(new ColorsServices(1, Colors.Yellow));
ColorCollection.Add(new ColorsServices(2, Colors.Green));
ColorCollection.Add(new ColorsServices(3, Colors.Gray));
ColorCollection.Add(new ColorsServices(4, Colors.PaleGreen));
ColorCollection.Add(new ColorsServices(5, Colors.Violet));
ColorCollection.Add(new ColorsServices(6, Colors.CadetBlue));
}
private ObservableCollection<ColorsServices> ColorCollection = new ObservableCollection<ColorsServices>();
и Сервис
public class ColorsServices
{
public ColorsServices(int id, Color name)
{
Id = id;
Name = name;
}
public int Id { get; set; }
public Color Name { get; set; }
}
public ObservableCollection<ColorsServices> ColorList
{
get { return ColorCollection; }
set { ColorCollection = value; }
}
На данный момент результат вот такой:
Как сделать что бы рядом со списком были отображены кружки с фоном данного цвета?
ColorList
?