Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
xamDataGrid custom field binding
posted

Hello!

In xamDataGrid control i have UnboundField, code:

<igDP:UnboundField Name="Preview" Label="Review">
<igDP:UnboundField.Settings>
<igDP:FieldSettings>
<igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">
<TextBlock>
<Hyperlink Click="Hyperlink_Click">Review</Hyperlink>
</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:FieldSettings.CellValuePresenterStyle>
</igDP:FieldSettings>
</igDP:UnboundField.Settings>
</igDP:UnboundField>

This code work fine, also in code i set DataSource of my xamDataGrid control,code:

xamDataGrid1.DataSource = o;


Declaration of o:

public ObservableCollection<DataGridItem> o = new ObservableCollection<DataGridItem>();

public class DataGridItem : INotifyPropertyChanged
{


string fio;
bool editisenabled;

public string FIO
{
get
{
return fio;
}
set
{
fio = value;
RaisePropertyChanged("FIO");
}
}
public bool EditIsEnabled
{
get
{
return editisenabled;
}
set
{
editisenabled = value;
RaisePropertyChanged("EditIsEnabled");
}
}

public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}

I want to bind my UnbountField with EditIsEnabled property of o object.

I try this xaml code, but it don't work:

<igDP:UnboundField Name="Preview" Label="Просмотр">
<igDP:UnboundField.Settings>
<igDP:FieldSettings>
<igDP:FieldSettings.CellValuePresenterStyle>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}">

<TextBlock>
<Hyperlink IsEnabled="{Binding Path=EditIsEnabled}" Click="Hyperlink_Click_1">Preview</Hyperlink>
</TextBlock>


</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</igDP:FieldSettings.CellValuePresenterStyle>
</igDP:FieldSettings>
</igDP:UnboundField.Settings>
</igDP:UnboundField>



Can some one help me?

How can i bind this HyperLInk IsEnabled property to EditIsEnabled property of my DataGridItem class?