0
我試圖把一個圖像可見或隱藏在rowHeader中。它正常工作,但對於NewItemPlaceHolder它始終可見。我如何隱藏NewItemPlaceHolder的圖像?RowHeaderTemplate和NewItemPlaceholder
<DataGrid.RowHeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type DataGridRow}},
Path=Item.xmlId}"/>
<Image Grid.Column="1"
Source="/MYAppli;component/Res/003_Fermer.png"
ToolTip="ERROR"
Margin="0"
Width="11" Height="11"
>
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type DataGridRow}},
Path=Item.HasError}" Value="true" >
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type DataGridRow}},
Path=Item.HasError}" Value="false" >
<Setter Property="Visibility" Value="Hidden" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Grid>
</DataTemplate>
在這裏你可以找到樣本,如何再整它http://stackoverflow.com/a/20651622/1979354 – Spawn
如何訪問我的圖片代碼? – Frederic7391