Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: CheckComboBox - ItemTemplate

$
0
0
Good morning,
i have some troubles with implementation of ItemTemplate to CheckComboBox. I need to customize viewing of enum values, but when i try to implement any DataTemplate, CheckComboBox does not react. May be i do some thing wrong?
<Style x:Key="comboItemContanerStyle" TargetType="{x:Type xctk:SelectorItem}">
  <Setter Property="Background" Value="Transparent" />
  <Setter Property="IsTabStop" Value="False" />
  <Setter Property="BorderThickness" Value="1" />
  <Setter Property="VerticalContentAlignment" Value="Center" />
  <Setter Property="Template" >
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type xctk:SelectorItem}">
        <Border x:Name="_background" 
                     Background="{TemplateBinding Background}" 
                     BorderBrush="{TemplateBinding BorderBrush}" 
                     BorderThickness="{TemplateBinding BorderThickness}">
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="auto"/>
               <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <CheckBox VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                      IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}" 
                      Grid.Column="0"/>
              <ContentPresenter Content="{TemplateBinding Content}"
                                          Grid.Column="1"
                                          Margin="5,0,0,0"/>
            </Grid>
          </Border>
          <ControlTemplate.Triggers>
          <Trigger Property="IsMouseOver" Value="true">
            <Setter TargetName="_background" Property="Background" Value="#FFB8E0F3" />
            <Setter TargetName="_background" Property="BorderBrush" Value="#FF26A0DA" />
          </Trigger>
        </ControlTemplate.Triggers>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>

<DataTemplate x:Key="WrappingComboTemplate">
  <TextBlock Text="{Binding Converter={StaticResource convert}}" />
</DataTemplate>

<xctk:CheckComboBox VerticalAlignment="Bottom"
                                  MaxHeight="50"
                                  Visibility="Collapsed"
                                  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                  ItemContainerStyle="{StaticResource comboItemContanerStyle}"
                                  ItemTemplate="{StaticResource WrappingComboTemplate}"/>

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>