Hi,
I have a converter for each field (ie. Column) in XamDataGrid. Is there any way to know in the converter's convert method that for which cell this is being executed and also how to know value of other cells in the same row when convert method is being executed for a cell?
Any help is appreciated,
Thanks.
Since this is in the template for a CellValuePresenter and the CellValuePresenter has a Record property you can probably do something like:
<igWindows:BoolToHiddenConverter x:Key="BoolToHidden" />
... Visibility="{Binding Path=Record.IsAddRecord,Converter={StaticResource BoolToHidden}, RelativeSource={RelativeSource TemplatedParent}}"
I'm not sure. I'm going to ask an engineer to look into this.
Thanks!
Any idea ?
Here's the context : I have a grid of users (username, first name, last name, etc). At the end of each row, there is a "Security" button that allows to edit the user's rights. However, when I am adding a record, I don't want the button to be visible, as all the required fields might not all be set.
This is what I have so far...
In the <igDP:XamDataGrid.Resources> section of the users grid, I have a style (key = DroitUsagerButtonCell) for my "Security" button. The template is set as follows :
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<Controls:CardPanel Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Style="{DynamicResource DroitUsagerButton}" Width="60" Height="11" VerticalAlignment="Center" HorizontalAlignment="Center"
Click="xamdgUsager_DroitUsagerClick" />
</Controls:CardPanel>
<ControlTemplate.Triggers>
<Trigger Property="HighlightAsPrimary" Value="True"/>
<Trigger Property="IsFieldSelected" Value="True"/>
<Trigger Property="IsSelected" Value="True"/>
<Trigger Property="IsActive" Value="True"/>
<Trigger Property="IsMouseOver" Value="True"/>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
The ButtonVisibilityConverter class looks like this :
public class ButtonVisibilityConverter : IValueConverter
{
}
What I would like to be able to do is to pass the (xamdgEntreprise.ActiveRecord as DataRecord).IsAddRecord property as a ConverterParameter to my IValueConverter, like this :
Visibility="{Binding Path=DataItem,Converter={StaticResource ButtonVisibilityConverter}, ConverterParameter=[SOMETHING HERE] }"
This way, I could hide the button when on the AddRow.
Your help is appreciated. Thank you!
I would like to be able to get a reference to the DataRecord or the value of one of the data records cells and pass it to the ValueConverter in the parameter object.
Here is a sample of the XAML. I have not been able to pass a data record via the ConverterParameter because I am not sure how to obtain a reference to it. I also have a small sample project and you could look at both of the things I am trying to accomplish and give me some help.
Thank you for your help.
<local:TaskNameHierDisplayConverter x:Key="TaskNameConverter" />
<Style x:Key="taskNameConverterStyle" TargetType="{x:Type igDP:CellValuePresenter}">
<ContentControl Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value, Converter={StaticResource TaskNameConverter}, ConverterParameter={x:Type igDP:ActiveRecord}}" />
</Style>