Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
I am able to use a ValueConverter to do what I need to, but would like to change this to a tigger. My problem is how to refer to the Content:

XML
<Style x:Key="BrokerCellPresenter2"
       TargetType="{x:Type igDP:CellValuePresenter}">
  <Style.Resources>
    <Converters:IfTrueValueConverter x:Key="InvisibleIfNullConverter"
                                     TrueValue="Visible"
                                     FalseValue="Hidden"
                                     NullValue="Hidden" />
  </Style.Resources>
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
        <Border Name="border"
                Visibility="{TemplateBinding Content, Converter={StaticResource InvisibleIfNullConverter}}"
                removed="#A50021"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch">
          <Polygon Points="1,0 0,1 4,5 0,9 1,10 5,6 9,10 10,9 6,5 10,1 9,0 5,4"
                   Fill="White"
                   HorizontalAlignment="Center"
                   VerticalAlignment="Center" />
        </Border>
        <!--<ControlTemplate.Triggers>
          <DataTrigger Binding="{TemplateBinding Content}"
                       Value="true">
            <Setter TargetName="border"
                    Property="Visibility"
                    Value="Visible" />
          </DataTrigger>
        </ControlTemplate.Triggers>-->
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>


I have the trigger commented out because I cannot seem to get the content which is a boolean. Only want the x to display if the value is true.
Posted

1 solution

Hi Clifford,

Try to use the following trigger:

XML
<Trigger Property="Content" Value="{x:Null}">
...
</Trigger>


Regards,
Rob
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900