Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

I have a databound DataGrid, which allows the user to add rows. That means, the last row is a placeholder, and if the user clicks into, a new data-record is generated, and the user can edit its properties.

unfortunally not every user knows that faboulous feature.
So i would like to display the text
"<enter new record here>"
on a cell of the placeholder-row.

how i can do that?
Posted

1 solution

You could use a custom template with some data triggers to say if it does not have a valid record to then change the template to this new EnterNewRecordTemplate that would show what you would like. Then when they do click on it the trigger would set it back to the normal template because you now have data.

If I have time to write up an example I can later, but i hope this gives you an idea for doing it in WPF.
 
Share this answer
 
Comments
Mr.PoorEnglish 18-Nov-10 12:52pm    
Hi!

I already use DatagridviewTemplateColumns with DataTemplates inside. But I have no idea, which Property i shall use as Trigger.
And I'm a little confused, because i can set Triggers in the DataTemplate, in the TextBlock and in the Style of the Textblock, and it might be a DataTrigger or a pure Trigger.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900