No, I 'm sure this is not an empty value .
I have lots of boxes in my application, and I have a global style for all:
And the text can chech the checkbox on click inside.
How can y just select the objet binded for pass value to CheckBox control ?
For exemple, if i use :
But if i use :
Is it possible ?
Regards
I have lots of boxes in my application, and I have a global style for all:
<Style TargetType="{x:Type CheckBox}">
<Setter Property="FontFamily" Value="Verdana" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<BulletDecorator Background="Transparent" SnapsToDevicePixels="true">
<BulletDecorator.Bullet>
<TextBlock Name="MyPin" Text="" FontFamily="Segoe UI Symbol" Foreground="{StaticResource scbBlue}" FontSize="14" />
</BulletDecorator.Bullet>
<TextBlock Text="{TemplateBinding ContentPresenter.Content}" TextWrapping="Wrap"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}" Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="true">
<Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/>
<Setter Property="Padding" Value="4,0,0,0"/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="MyPin" Property="Text" Value="" />
<Setter TargetName="MyPin" Property="Foreground" Value="{StaticResource scbBlack}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
in short, I want to merge the CheckBox with ContentPresenter for apply a common style (checkbox style).And the text can chech the checkbox on click inside.
<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 Grid.Column="0" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}}" >
</CheckBox>
<ContentPresenter Grid.Column="1" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" 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>
But, the Content="{TemplateBinding Content}" is not the object content, at first glance.How can y just select the objet binded for pass value to CheckBox control ?
For exemple, if i use :
<CheckBox Grid.Column="0" Content ="Coucou" ... />
<ContentPresenter Grid.Column="1" Content="{TemplateBinding Content}" ... />
In each item, i See "Coucou MyObjectValue1".But if i use :
<CheckBox Grid.Column="0" Content ="{TemplateBinding Content}" ... />
<ContentPresenter Grid.Column="1" Content="{TemplateBinding Content}" ... />
I just see "MyObjectValue1", i want see "MyObjectValue1 MyObjectValue1".Is it possible ?
Regards