locked
Isenabled property in WPF not working on mouse right click RRS feed

  • Question

  • Hi,

       I set Isenabled =false on a paticular condition using trigger evry thing got disabled but mouse right click is working and Getting selected,can any one let me know how to resolve this issue.

     

    Thanks in Advance

    Thursday, October 14, 2010 3:38 PM

Answers

  • Good morning,

    If the IsEnabled property is getting appropriately set then it's probably not an issue with your trigger (especially since your trigger is working).  Is the context menu you're retrieving on right-click one that you've defined and want to disable or a standard context menu for windows?  If you want to disable it entirely you can hook the PreviewMouseRightButtonDown event and set it to handled so that nothing occurs...I'm not entirely sure how you would do it as part of a trigger, but I'm sure if you search or post a new issue that someone will be able to provide you the syntax.

     

    Hope it helps,

    Aj


    If at first you don't succeed, skydiving is definitely not for you!
    • Proposed as answer by aaj23 Friday, October 15, 2010 1:14 PM
    • Marked as answer by Min Zhu Wednesday, October 20, 2010 5:14 AM
    Friday, October 15, 2010 1:13 PM

All replies

  • Please Reply ,it is pretty urgent
    Thursday, October 14, 2010 6:42 PM
  • Please post the XAML for your control and the corresponding trigger...otherwise it will be very difficult to guess based on your description.
    If at first you don't succeed, skydiving is definitely not for you!
    Thursday, October 14, 2010 7:34 PM
  • Hi Thanks for your help,

    I Just Added this Code as style

     <Style x:Key="RowStyle" TargetType="{x:Type dg:DataGridRow}">
    
        <Style.Triggers>
          <DataTrigger Binding="{Binding ZZZ}" Value="AAAA">
    
              <Setter Property="IsEnabled" Value="false"/>
                  </DataTrigger>
    
        </Style.Triggers>
    
    
    Friday, October 15, 2010 6:23 AM
  • Hi,

    If you write a data trigger, you have to check weather value is true or false, based on that you can use setter.

    I think in your case, you are not checking that value is true or false.

    So Please check those thing.

     

     

    Thanks,

    Rajnikant

    Friday, October 15, 2010 6:33 AM
  • Make sure whether Binding happens or not

    use Output window to check the Binding

    try to use RelativeSource if Binding problem exists with the style

     

    Friday, October 15, 2010 10:10 AM
  • Hi Rajni,

              I am checking with a property ,if that property is true i am makingisEnabled=true.Because of this the Entire row is getting disabled but the strange thing is mouse right click is not disabled.Please give me some suggestion to resolve this.

    Friday, October 15, 2010 10:31 AM
  • Hi ,

    Bhavik ,the the rows are geeting binded but the problem is when the isenabled property becomes false,the entire row is getting disabled Except Mouse Right click

    Friday, October 15, 2010 10:33 AM
  • Good morning,

    If the IsEnabled property is getting appropriately set then it's probably not an issue with your trigger (especially since your trigger is working).  Is the context menu you're retrieving on right-click one that you've defined and want to disable or a standard context menu for windows?  If you want to disable it entirely you can hook the PreviewMouseRightButtonDown event and set it to handled so that nothing occurs...I'm not entirely sure how you would do it as part of a trigger, but I'm sure if you search or post a new issue that someone will be able to provide you the syntax.

     

    Hope it helps,

    Aj


    If at first you don't succeed, skydiving is definitely not for you!
    • Proposed as answer by aaj23 Friday, October 15, 2010 1:14 PM
    • Marked as answer by Min Zhu Wednesday, October 20, 2010 5:14 AM
    Friday, October 15, 2010 1:13 PM