I am trying to do something in WPF. I have a datagrid that I am binding with some values. What I need is that whenever I call that page the second time, I need to insert a button to all the cells of all the columns in the datagrid(except for the cells in the first column which are bound to some value). How can I do that? Please help.
A:
You could add collapsed (hidden buttons that don't take up space) buttons to the cells and make them visible when needed.
This behaviour also can be bind to some condition with an IValueConverter on the visibility-property.
UPDATE tx to the comment I know there is a build in converter, so here's the deal :
- you add a this converter to your window resources
<Window.Resources> <BooleanToVisibilityConverter x:Key="myConverter"/> </Windos.Resources>
- you use it in your button
<Button Visibility="{Binding Path=myCondtion,Converter={StaticResource myConverter}}"/>
where myContition is a property you have to create in your class. The value of this property should be true when you want your button to show , or false when you want it to be hidden..
Peter
2009-11-18 08:29:14
there is already a BooleanToVisibilityConverter available in wpf, so you don´t have to create your own IValueConverter for this one.
Joachim Kerschbaumer
2009-11-18 08:39:55
Ok. I really appreciate your quick reply. But I am an amateur coder, and I couldnt understand what I was supposed to do. Please, could you help me by telling me in steps as to what I should do? Please!
Gagan
2009-11-18 08:54:35