tags:

views:

658

answers:

1

Is there any way to style the checkbox in there? iv tried to define a style for the checkbox but that didn't work.

after using mole it seems like the checkbox control does not have a ToggleButton in it it uses a BulleDecorator instead, im not sure of this first time im using mole..

What i want to achieve is that instead of a check box i want a red or green circle.

<Style TargetType="{x:Type CheckBox}">
 <Setter Property="IsHitTestVisible" Value="False"/>
 <Setter Property="Focusable" Value="False"/>
 <Setter Property="HorizontalAlignment" Value="Center"/>
 <Setter Property="VerticalAlignment" Value="Top"/>
 <Setter Property="Template"> 
  <Setter.Value> 
   <ControlTemplate TargetType="{x:Type ToggleButton}"> 
       <Border x:Name="innerBorder"> 
          <Ellipse Fill="#FFFF0000" Stroke="#FF000000" Stretch="Fill" x:Name="statusLight" Width="15" Height="15" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Center"/>
       </Border> 
       <ControlTemplate.Triggers> 
           <Trigger Property="IsChecked" Value="True"> 
     <Setter TargetName="statusLight" Property="Fill" Value="#FF00FF00" />
           </Trigger> 
      <Trigger Property="IsChecked" Value="False"> 
     <Setter TargetName="statusLight" Property="Fill" Value="#FFFF0000" />
           </Trigger> 
       </ControlTemplate.Triggers> 
   </ControlTemplate> 
  </Setter.Value> 
 </Setter>
</Style>
+1  A: 

Hey Petoj,

It looks like you are looking for DataGridBoundColumn.ElementStyle property (DataGridCheckBoxColumn is derived from DataGridBoundColumn). In case this doesn't work for you, you can always use DataGridTemplateColumn to display anything you want.

Refer to Vincent Sibal's blog if you need more information on this.

Anvaka