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
245
XamGrid Custom Column binding issue
posted

Hello,

I am using Xamgrid in our project.  We have requirement like below :-

once user double click one of the specific column ( large comment details column) , one new window will open as a dialog with one big Textbox , ok and cancel button. User will able to view whole commnet in this dialog in the textbox and also if IsEditable property is true, then they can also able to edit it in the same textbox.

And we need this type of column behavior in number of grids in our project. So I have created a custom column of XamGrid. and register the double click event in the column provider and open the new dailog. Everything works fine.

The problem is  :- I am not able to bind IsEditable to the IsReadOnly property of column. So its always editable.  :(

PFA for the dummy project to replicate the issue. 

Once you run the project.  you will 2 coulmns ID and Description. ID coulmn has tooltip which binds with the IsEditable property. So tooltip is different in different rows.

But the second column  Description , once u double click , it will open a MessageBox with IsEditable property and its shows always false and then open my dialog box which is also editable for all rows As its not binded properly. :(

<ig:XamGrid ActiveItem="{Binding SelectedItem}" ItemsSource="{Binding TestItemSource}" AutoGenerateColumns="False" x:Name="XamGrid">
<ig:XamGrid.EditingSettings>
<ig:EditingSettings AllowEditing="Row" IsMouseActionEditingEnabled="DoubleClick"></ig:EditingSettings>
</ig:XamGrid.EditingSettings>

<ig:XamGrid.Columns>

<ig:TextColumn Key="Id" IsReadOnly="True" AllowToolTips="Always" x:Name="idKey">
<ig:TextColumn.ToolTipContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding IsEditable}"></TextBlock>
</DataTemplate>
</ig:TextColumn.ToolTipContentTemplate>
</ig:TextColumn>

<longTextColumnPoc:LongTextColumn Key="Description" IsReadOnly="{Binding IsEditable}"></longTextColumnPoc:LongTextColumn>

</ig:XamGrid.Columns>

This binding in bold is not working.

Below is the model of my gird.

private BindingList<TestModel> _testItemSource = new BindingList<TestModel>();
public BindingList<TestModel> TestItemSource
{
get
{
return _testItemSource;
}

set
{
_testItemSource = value;
RaisePropertyChanged("TestItemSource");
}
}

public class TestModel
{
public string Id { get; set; }
public string Description { get; set; }

public bool IsEditable
{
get
{
if (Id == "1") return false;
return true;
}
}
}

LongTextColumnPOC.zip