# .NET and More > WPF, WCF, WF >  [Resolved] Silverlight 2: Disable datagrid row- and cellselection

## vbNeo

Hi everyone,

First of all, I'd like to apologize if this isn't the correct forum for Silverlight posts, but I couldn't seem to find the right one.

I have a DataGrid with a set af TemplateColumns, and what I basically want to do is create "links" inside each of these. Now this is pretty easy to achieve, but my problem is that the DataGrid selects a row, and a cell when the user clicks them - which is not the functionality I want.

One might argue that the DataGrid isn't the control I should be using, however, I do need the sorting and columnresizing features etc. so I don't really know of a viable alternative.

I've tried hacking my way out of it by setting the SelectedItem property to Null on the SelectionChanged event. This works for the row selection, however cells still get selected.

Is there any way to disable cellselection, without having to use the VSM and setting a style for the Row itself when a cell is selected(Setting the border opacity to 0) - so far this is the only solution I've seen, and I don't care much for it...

Thanks in advance.

----------


## DeanMc

This is indeed the correct section. The only way I know how is the way you mentioned. The DGV is rather lacking in WPF and I imagine most new controls that come out will be the same, this is, as you have stated because of styles. All controls are designed to be look less so I believe that Microsoft are only going to provide the most basic features with controls so they can encourage heavy use of styles.

----------


## chris128

I dont know if this helps at all (and I dont even know if it is possible to do in Silverlight) but have you thought of using a ListView to create a data grid (by using the GridView view mode) instead of using whatever datagrid control you are using? That way you dont have 'cells' so if someone clicked a link in one of your items in the listview/grid then nothing would be selected if you set the necessary selection mode properties. Then if you do want to have editable 'cells' in some of the columns you can just use the method I discussed in this thread to do that: http://www.vbforums.com/showthread.php?t=555235 (last post, although the first two may be of interest anyway)

----------


## vbNeo

@DeanMC: Yeah I though so, but I'd just want to check out if there was some sort of hack that'd be easier and require less xaml.

@chris: Interesting idea  :Smilie:  although I'm quite sure it won't work in Silverlight, I'm gonna check it out later this afternoon(I'm not even sure Silverlight has the listview control)

Thanks for your quick responses.

----------

