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?
Hi,
I have provided a sample above.
If you have any difficulties downloading it, I will provide it for you again.
Thanks,
Stefana
Thanks, it work.
The attached sample is doing what you have described in the post above - the Hyperlink IsEnabled property is bound to the corresponding property from the data source.
If you need further assistance, do not hesitate to ask!