How make datagrid cell clicking not to affect the row selected?

Hi all,
I made SelectionUnit as FullRow. The first column, second column, and so on, which can work well for selecting row when I clicking the cells of them.
But I want the last column to remove the affection that the whole row is selected when I click last column cell.
how to do it? thanks.
<DataGrid ItemsSource="{Binding itemSource}" AutoGenerateColumns="False" RowHeight="25" SelectionUnit="FullRow"

You could set the AutogenerateColumns property to false, define all columns in the XAML markup explicitly and then specify a CellTemplate for the last column and handle its MouseLeftButtonDown event to change the SelectionUnit property of the DataGrid. Here
is an example for you:
<DataGrid x:Name="dg" AutoGenerateColumns="False" RowHeight="25" SelectionUnit="FullRow">
<DataGrid.Resources>
<Style TargetType="DataGridCell">
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="cell_MouseLeftButtonDown"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding A}"/>
<DataGridTextColumn Binding="{Binding B}"/>
<DataGridTextColumn Binding="{Binding C}">
<DataGridTextColumn.CellStyle>
<Style TargetType="DataGridCell">
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="cell_MouseLeftButtonDownLast"/>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
List<MyItem> items = new List<MyItem>();
items.Add(new MyItem() { A = "1", B = "1", C = "1" });
items.Add(new MyItem() { A = "2", B = "2", C = "2" });
dg.ItemsSource = items;
void cell_MouseLeftButtonDownLast(object sender, MouseButtonEventArgs e)
dg.SelectionUnit = DataGridSelectionUnit.Cell;
void cell_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
dg.SelectionUnit = DataGridSelectionUnit.FullRow;
Please remember to mark all helpful posts as answer to close the thread and then please start a new thread if you have a new question.

Similar Messages

  • Creation of credit notes without affecting the stock on FI side.

    Hello,
    We would like to know about the procedure to follow to create credit notes without affecting the stock.
    For instance a credit note has to be made because the invoice pricing was not correct (discount not taken into account,etc...). We want to issue a credit note for the customer in value (not in quantity) refering to this invoice.
    How to process? Is it supposed to be through a FI transaction?
    Thanks and Regards,
    Rajesh Kumar Mantri

    Dear,
    Use transction FB70 and select Credit Memo in transaction and pass the entry and mention the invoice numner in field Inv. Ref. under payment tab..
    Regards,
    Chintan Joshi

  • How to resolve "movie was not copied to the iPod because it cannot be played on this iPod".

    how to resolve "movie was not copied to the iPod because it cannot be played on this iPod".

    See:
    iTunes: May be unable to transfer videos to iPhone, iPad, or iPod
    iTunes: Frequently asked questions about viewing and syncing videos
    iTunes: Sync purchased HD videos to iPod or iOS device
    iTunes says my purchased video isn't...: Apple Support Communities

  • How can I get iCal not to show the same birthday dates from my iCloud

    How can I get iCal not to show the same birthday dates from my iCloud?

    You don't need them stored locally for a backup. You can manually export your contacts as archive for backup. Also, if you are backing up with Time Machine, you already have a backup. If your hard drive crashed, you would have to rely on your backup or iCloud anyway.
    So, if you're comfortable with that, sign out of iCloud. Choose to delete contacts from the computer. When you sign back into iCloud, you should only have iCloud contacts listed in AB. When you open iCal, you should only have one listing for birthdays.
    The other alternative is to disable the Birthday c.alendar and create one manually.

  • HT201407 how to fix iphone could not activated because the activation server is temporarily unavailable

    Dear All,
    After I upgrade ios4.1 to ios6.1.3 but my iphone 3gs shows the sentence below:
    how to fix iphone could not activated because the activation server is temporarily unavailable
    Please give me the ways to fix it
    Thanks in advance

    Thi is usually a symptom that the phone has been hacked or jailbroken. Has it?

  • ALV not showing all the rows! Please help!

    Hi Experts,
         I have webdynpro ALV report and I am using SALV_WD_TABLE as the reusable component. In component controller's WDDOINIT I have written the code for pulling teh data from R/3 table and binding it to ALV table.
    In the view's WDDOMODIFYVIEW event I have written the following code to get subtotal and grand total of Qty column based on product column.
          I have coded like this:
          lr_field_settings ?= l_value.
    lr_field = lr_field_settings->get_field( 'PRODUCT' ).
    lr_field->if_salv_wd_sort~set_group_aggregation_allowed( ABAP_TRUE ).
    lr_field->if_salv_wd_sort~create_sort_rule( ).
    l_sortrule = lr_field->if_salv_wd_sort~GET_SORT_RULE(  ).
    l_sortrule->set_sort_order( if_salv_wd_c_sort=>sort_order_ascending ).
    l_sortrule->set_group_aggregation( ABAP_TRUE ).
    *...Aggregate Field PRODUCT
    lr_field = lr_field_settings->get_field( 'QTY' ).
    lr_field->if_salv_wd_aggr~create_aggr_rule( ).
    lr_aggr_rule = lr_field->if_salv_wd_aggr~get_aggr_rule(  ).
    lr_aggr_rule->set_aggregation_type( if_salv_wd_c_aggregation=>aggrtype_total ).
    It is working now but my ALV table is not showing all the rows. I have 6 products and it is showing from product 2. But it is calculating grand total and subtotal correctly. I am not able to see the first product row and subtotal for that. Even if I click on the ^ icon in the ALV table below it is not showing all the rows.
    What could be the problem?
    Please help
    Thanks
    Gopal

    did you somehow manage to set the "first visible row" property on table object
    to 2.   Only thing I can think of that could cause this effect.
    Cheers
    Phil

  • Alv is not appearing in the same Selection Screen

    Hi people..
    First time using  cl_gui_docking_container.
    I have a problem, my alv is not appearing in the same Selection Screen.
    is there somethign wrong with my code? it doesnt even show a dump or catch.
    Regards
    DATA: lo_dock TYPE REF TO cl_gui_docking_container,
           lo_cont TYPE REF TO cl_gui_container.
    DATA: gr_table      type ref to cl_salv_table,
           gr_functions  type ref to cl_salv_functions,
           gr_display    type ref to cl_salv_display_settings,
           gr_columns    type ref to cl_salv_columns_table,
           gr_column     type ref to cl_salv_column_table,
           gr_sorts      type ref to cl_salv_sorts,
           gr_agg        type ref to cl_salv_aggregations,
           gr_filter     type ref to cl_salv_filters,
           gr_layout     type ref to cl_salv_layout,
           color         type lvc_s_colo,
           key           type salv_s_layout_key.
       SELECT * INTO TABLE tbl_datos_items FROM zsd_micros_bd.
    CHECK lo_dock IS INITIAL.
      CREATE OBJECT lo_dock
           EXPORTING
             repid = sy-cprog
             dynnr = sy-dynnr
             ratio = 70
             side  = cl_gui_docking_container=>dock_at_bottom
             name  = 'DOCK_CONT'.
         IF sy-subrc <> 0.
           MESSAGE 'Error in the Docking control' TYPE 'S'.
         ENDIF.
    TRY.
    lo_cont ?= lo_dock.
    cl_salv_table=>factory(
    exporting r_container      = lo_cont
                 container_name = 'DOCK_CONT'
                 list_display   = if_salv_c_bool_sap=>false
    importing r_salv_table = gr_table
    changing t_table = tbl_datos_items  ).
    CATCH cx_salv_msg .
    ENDTRY.
    gr_functions = gr_table->get_functions( ).
    gr_functions->set_all( abap_true ).
      gr_display = gr_table->get_display_settings( ).
      gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
      gr_display->set_list_header( 'Items de Ventas' ).
      gr_table->display( )

    Hi ,
    First you have to create you own screen ( dynpro )  with a screen number ( 0101 for exemple )  , you need to pu a custom control in it , name the custom control ( lo_cont )
    For the screen created you need to create a module for the PBO , in this module you sould put you code for displaying the liste :
    Module STATUS_0101 output.
    TRY.
    lo_cont ?= lo_dock.
    cl_salv_table=>factory(
    exporting r_container      = lo_cont
                 container_name = 'DOCK_CONT'
                 list_display   = if_salv_c_bool_sap=>false
    importing r_salv_table = gr_table
    changing t_table = tbl_datos_items  ).
    CATCH cx_salv_msg .
    ENDTRY.
    gr_functions = gr_table->get_functions( ).
    gr_functions->set_all( abap_true ).
      gr_display = gr_table->get_display_settings( ).
      gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
      gr_display->set_list_header( 'Items de Ventas' ).
      gr_table->display( ).
    Endmodule.
    and give the screen number when calling  lo_dock 
    CREATE OBJECT lo_dock 
           EXPORTING
             repid = sy-cprog
             dynnr = '0101'.
    tested
    Regards

  • InfoPath form load rule is not checking all the rows in form library

    Hi,
    Requirement:
    We have a form library named "HR Annual Review". In the InfoPath form we have two buttons "Save" and "Submit". User is allowed to Save multiple times and only once using Submit button. The file name of form library "HR
    Annual Review" will be stored in the format “<username>+<mm>+<dd>+<yy>.xml”. Say for example, an user named Mike Walt submitted a form then the file name will be as “MikeWalt012314.xml”. If the same user (Mike Walt)
    submits the form and tries to open the form for subsequent edit, then we need to show a view which has an error info saying “The Appraisal is already submitted for the current appraisal cycle”.
    Solution we tried:
    To achieve the above requirement, we tried using InfoPath Form Load and add a rule to check whether the combination of current user name and the year already exists in the filename column of the form library. But the rule we applied is not checking all the
    rows in the form library. The rule is always checking the first row of the form library.
    What we need:
    We need the validation using InfoPath rule or some other way/solution to check whether the combination of current login username and current year file already exists in the form library.
    Thanks in advance.
    Srivignesh J

    Hi Srivignesh,
    Submit button Uses the Main Data connection to submit the data to the list. This is what you are using and naming the file in the format. You can create secondary data submit that will update the exiting item in the list. With this, you don't have to create
    any rules to check all the rows which is also not possible in OOB InfoPath.
    Once you have the two data connection, hide the toolbar from the form and display these two on the button. For The Submit button, apply the rule to hide the button if created by is not empty. For Save button, apply the rule to hide the button if Created
    By is empty. This way, when a new form is created, you will see the Submit button, and when the user have to update the form, they will see Save button. Hope it help.s
    Regards, Kapil ***Please mark answer as Helpful or Answered after consideration***

  • How do I change the row selection by mouse movement

    How do I change the row selection on a jtable by mouse over events?
    Thanks, Randy

    got it thanks...

  • How to view cell reference not its text name?

    One of my spreadsheets in Numbers 3.0.1 is displaying cell text descriptions when I view formulas.  Somewhere there must be an option to view the alpha-numeric cell reference ID's, re: A1, A2 - etc.  But, I can't find where it's hiding.  Can someone please tell me where to look?  Thanks.

    The last reply was a while back, but since this was useful to me, and I tend to agree with SGIII about not being able to turn it off, here's what I did for my iPhone (but what a pain to have to deal with something like this.)
    It's easier to do this on the Mac and then mail it out for the iPhone (mine is 5s with latest 7.)  The names that will be used for cell names in formulae are the nearest row header to the left and nearest column header upwards.
    Insert a new header row after any text headers you have, if any, and leave the just created one blank and hide it.  Do the same for the column headers.  In my case, I didn't have any row text headers so I just have one blank, hidden header.  I did have column headers so I added a extra blank, hidden header beneath it.
    Now, all that voluminous and, in my opinion, confusing cell naming business in formulae goes away and the actual A1-type references will appear.

  • Make my right click context menus occur only in selected divs

    Hi
    I want to make some context menus for certain divs in my website page. So the person viewing the site sees a link to a music file and they right click on the link to get more options but instead of the default browser options coming up, a customized list comes up.
    This is just an example. The real thing is that I want multiple menus that work in selected divs only. So if you click in most places on the page you get the default context menu but if you click within certain divs you get a different menu.
    So far everyone has just given me java script but i can't set html links inside of javascript. Can anyone tell me how to take this script and make it apply to divs instead of the whole document?
    <script src="SpryAssets/SpryTooltip.js" type="text/javascript"></script>
        <script type="text/javascript">   
        var contextMenuObj;
        var MSIE = navigator.userAgent.indexOf('MSIE')?true:false;
        var navigatorVersion = navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1;   
        var activeContextMenuItem = false;
        function highlightContextMenuItem()
            this.className='contextMenuHighlighted';
        function deHighlightContextMenuItem()
            this.className='';
        function showContextMenu(e)
          contextMenuSource = this;
          if(activeContextMenuItem)activeContextMenuItem.className='';
          if(document.all)e = event;
          var xPos = e.clientX;
          if(xPos + contextMenuObj.offsetWidth > (document.documentElement.offsetWidth-20)){
           xPos = xPos + (document.documentElement.offsetWidth - (xPos + contextMenuObj.offsetWidth)) - 20;
          var yPos = e.clientY;
          if(window.document.body.scrollTop > 0)
              yPos = (window.screen.Height) ? e.clientY + window.document.body.scrollTop -20 : e.clientY -20;
            else if (window.pageYOffset)
              yPos = (window.pageYOffset > 0) ? e.clientY + window.pageYOffset -20 : e.clientY -20;
            else
            { yPos = e.clientY -20; }
          contextMenuObj.style.left = xPos + 'px';
          contextMenuObj.style.top = yPos + 'px';
          contextMenuObj.style.display='block';
          return false;
        function hideContextMenu(e)
            if(document.all) e = event;
            if(e.button==0 && !MSIE){
            }else{
                contextMenuObj.style.display='none';
        function initContextMenu()
            contextMenuObj = document.getElementById('contextMenu');
            contextMenuObj.style.display = 'block';
            var menuItems = contextMenuObj.getElementsByTagName('LI');
            for(var no=0;no<menuItems.length;no++){
                menuItems[no].onmouseover = highlightContextMenuItem;
                menuItems[no].onmouseout = deHighlightContextMenuItem;
                var aTag = menuItems[no].getElementsByTagName('A')[0];
                var img = menuItems[no].getElementsByTagName('IMG')[0];
                if(img){
                    var div = document.createElement('DIV');
                    div.className = 'imageBox';
                    div.appendChild(img);
                    if(MSIE && navigatorVersion<6){
                        aTag.style.paddingLeft = '0px';
                    var divTxt = document.createElement('DIV');   
                    divTxt.className='itemTxt';
                    divTxt.innerHTML = aTag.innerHTML;
                    aTag.innerHTML = '';
                    aTag.appendChild(div);
                    aTag.appendChild(divTxt);
                    if(MSIE && navigatorVersion<6){
                        div.style.position = 'absolute';
                        div.style.left = '2px';
                        divTxt.style.paddingLeft = '15px';
                    if(!document.all){
                        var clearDiv = document.createElement('DIV');
                        clearDiv.style.clear = 'both';
                        aTag.appendChild(clearDiv);       
                }else{
                    if(MSIE && navigatorVersion<6){
                        aTag.style.paddingLeft = '15px';
                        aTag.style.width = (aTag.offsetWidth - 30) + 'px';
                    }else{
                        aTag.style.paddingLeft = '30px';
                        aTag.style.width = (aTag.offsetWidth - 60) + 'px';
            contextMenuObj.style.display = 'none';       
            document.documentElement.oncontextmenu = showContextMenu;
            document.documentElement.onclick = hideContextMenu;
        </script>
    If anyone has an alternative to this that will allow me to apply the following link to one of the items in the  menu I'd like to hear it.
    This is the link that I want to use: <a href="Test Audio File.mp3"  download="Test Audio File.mp3">
    Thanks
    Tohorhilau

    Hi, thanks for the quick response!
    While trying to find info on how to fix this I looked up some context menu addons for FF and tried one. It didn't work so I uninstalled it and after that everything was back to normal. Odd, but there you have it. I still don't know what went wrong in the first place but for the moment it appears to have cleared up.
    Next time though I will try loading into Safe Mode if I find any issues (I forgot there was one!).
    Thanks for getting back to me again.
    GC

  • How to bulk delete email - not 5 or 10 by selecting all the emails one by one but "delete before..." or similar

    Hi Cimmunity
    as you often traval and as you say have a lot of emails: how do you delete them in masses like bulk delete? on my old blackberry (newstes except z10) I had the option to "delete all before (...) date" in the context menu and could delete 1500 emails with one tap. do you know how to do this now? there is no such function, one have to tap and mark every single email, even if there are 2000!!!!! crazy!!
    thanks a lot!!
    BB: please urgently add the feature again...!!!! I have a imap account with about 200 emails a day which are just copies of enterprise mail and need to delete hundreds every day. I can not tap and select all the single mails one by one and then delete.
    Solved!
    Go to Solution.

    Go into the hub, select email account, Just under the blue email account, click and hold the date bellow it , slider pops on the right, click on Trash can(delete prior).

  • Why is the movie "How to train your dragon" not available in the US itunes store?

    I am about to travel out of the USA for a extended period of time, and what I can pack is limited. I felt it would be a better choice to buy a digital version of my favorite movie "How to train your dragon" which when I search for it on the web I can find it (https://ssl.apple.com/itunes/charts/movies/how-to-train-your-dragon/). But when I go to open it up or search for the movie in itunes... it does not exist. In fact, it says as part of the error that it doesn't exist in the USA store.
    This confuses me because it was produced by a USA company and you can get the movie in Blueray and normal DVD at any store in the USA, yet iTunes seems to have blocked all sales of it.
    So I would just like to know why it is currently unavailable, and when I can hope to be able to purchase it. Thank you.
    -Concerned customer

    Except it was on itunes, otherwise that link wouldn't exist, and it wouldn't state that the movie was in the top ten retals. So the company had to have given the rights to sell to itunes before now, and since it is still showing up on the apple main site as being accessable, despite not exisiting in iTunes, the movie must have already been on itunes.
    I'm not "waiting" for the initial release of this movie and being impatient, I'm frustrated because apple says its available but iTunes says it isn't. I just want the movie in a digital form. Thats all I'm asking.
    I'm asking here because there is no way I have found to get my question into the fortknox that is the Apple/itunes customer service.

  • How come Application Express forum not shown in the list

    Hi there
    when I search the forums I cannot find Apex. I have to go to APex home page
    p
    Edited by: PJ on Nov 24, 2012 6:33 AM

    Start at the home page for the entire OTN forum web site
    https://forums.oracle.com
    See the category that is named Oracle Database?
    Right-click that and open the link in a new browser page or a new browser tab (your choice).
    That will show you a list of absolutely every current forum related to Oracle's database products.
    ApEx is the sixth forum in that list.
    Alternative method?
    Go back to that home page for the forum web site.
    See the `+` sigh in front of the words Oracle Database?
    Click on that to expand out the first layer of topics.
    See the choice that labeled "More"? Select that.
    You end up at the same view as with the first method I described.
    Nether method is particularly difficult.

  • How do I print an excel worksheet so the rows have contrasting shades making it easy to read data across the page?

    I want to print an excel worksheet so that the rows are shaded light then dark, light then dark. This helps when reading the data across the page on any selected line. Where do I select that option?

    sophia beth wrote:
    I want to print an excel worksheet so that the rows are shaded light then dark, light then dark. This helps when reading the data across the page on any selected line. Where do I select that option?
    Not sure if it's any better in the version you have, but in earlier versions, you would have to manually select alternating rows using cmd-click in the row numbers and then fill the cells with the lightest possible shade in the fill palette.  Again, in an earlier version, it is possible to use the format painter (use your Excel help for details) to select several rows formatted with the shading and paint that format to an equivalent number of rows elsewhere.

Maybe you are looking for