I'm new at WPF. I have stuck somewhere in XAML. This XAML code is working:
<DataGridTextColumn Binding="{Binding Model.Name, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<DataTrigger Value="False"
Binding="{Binding DataContext.Model.Error[All],
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type DataGridRow}},
Converter={StaticResource IsNull}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border>
<Grid>
<ContentPresenter x:Name="_cp" />
<Image Source="{DynamicResource Img.Warning}"
ToolTip="{Binding DataContext.Model.Error[Name],
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type DataGridRow}}" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
I want to get variables strings like "All", "Name" from first line's Binding info to use in Image Tooltip Binding. As you can see, the binding info at first line is "Model.Name" here. I can get just "Name" string using Converter but I can't reach that binding info.
When I searched, I found a suggestion to use MultiBinding and I wrote this code:
<DataGridTextColumn Binding="{Binding Model.Name, UpdateSourceTrigger=PropertyChanged}">
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<DataTrigger Value="False">
<DataTrigger.Binding>
<MultiBinding>
<MultiBinding.Converter>
<conv:DictionaryItemConverter />
</MultiBinding.Converter>
<Binding Path="DataContext.Model.Error"
RelativeSource="{RelativeSource FindAncestor,
AncestorType={x:Type DataGridRow}}" />
<Binding Path="?????" RelativeSource="?????" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border>
<Grid>
<ContentPresenter x:Name="_cp" />
<Image Source="{DynamicResource Img.Warning}">
<Image.ToolTip>
<Binding>
?????
</Binding>
</Image.ToolTip>
</Image
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
But as you can see, I have stuck to get the string info. BTW, DataContext.Model.Error is a class that is working like a Dictionary Class and DictionaryItemConverter is getting value from this class
As a result, my problem is this.
How can I reach DataTextColumn's Binding info as string?
Thank you in advance for all answers.
P.S.: English is not my first language. If I made a mistake, sorry.
P.S.: I have created a sample to show it what I want. You can download it here: https://mega.nz/#!oIJXgLxb!eBNqOIdby0UgkKgfqgCOVqYE1O-KwQH7cfEQxk6aCd0