Results 1 to 4 of 4

Thread: [Resolved] Silverlight 2: Disable datagrid row- and cellselection

  1. #1

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    [Resolved] Silverlight 2: Disable datagrid row- and cellselection

    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.
    Last edited by vbNeo; Feb 6th, 2009 at 02:38 AM. Reason: Post resolved
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  2. #2
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: Silverlight 2: Disable datagrid row- and cellselection

    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.

  3. #3
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Silverlight 2: Disable datagrid row- and cellselection

    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)
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  4. #4

    Thread Starter
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: Silverlight 2: Disable datagrid row- and cellselection

    @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 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.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width