Binding lack of the Silverlight DataGrid CellTemplate
Be aware of this.
Silverlight 5.
DataGrid
DataGridTemplateColumn.CellTemplate
Visibility (!!!)
It doesn’t work, at all:
Visibility="{Binding Path=Detail, Converter={StaticResou rce VisibleNonEmptyConverter}} "
This is working:
Visibility="{Binding Path= DataContext, RelativeSource={R elativeSource Self}, Converter ={StaticResource VisibleNonEmptyConverter}}"
DataContext="{Binding Path=Detail}"
<data:DataGrid
ItemsSource="{Binding Path=Items}"
AutoGenerateColumns="False"
HeadersVisibility="None"
Background="Transparent"
HorizontalAlignment="Left"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
AlternatingRowBackground="LightGray"
RowBackground="White"
>
<data:DataGrid.Columns>
<data:DataGridTextColumnBinding="{Binding Path=Name}" IsFrozen="True" IsReadOnly=" True"/>
<data:DataGridTemplateColumn>
<data:DataGridTemplateColumn. CellTemplate>
<DataTemplate>
<Grid
VerticalAlignment="Center"
DataContext="{Binding Path= Value}"
>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Path =Exact}" VerticalAlignment=" Center" Margin="3 0"/>
<!--, FallbackValue=Collapsed, TargetNullValue=Collapsed-->
<Image
Grid.Column="1"
Source="/HCFB.UFO.Web; component/Resources/Images/ info.v2.png"
Width="16"
Margin="3 1"
VerticalAlignment="Center"
Visibility="{Binding Path=DataContext, RelativeSource={R elativeSource Self},
DataContext="{Binding Path= Detail}"
MouseLeftButtonUp=" DetailImage_MouseLeftButtonUp"
/>
</Grid>
</DataTemplate>
</data:DataGridTemplateColumn. CellTemplate>
</data:DataGridTemplateColumn>
</data:DataGrid.Columns>
</data:DataGrid>
Comments
Post a Comment