locked
User Control drop down on mouse hover... RRS feed

  • Question


  • Hello,

    In my application, i have a user control (or a window) which i want to drop down (flow down) when user places a mouse on one of the button. How i can position the User control to get the drop down or flow down effect in the UI for the respective User Control. This effect should be reusable for the user control because location of button can be changed from one window to another.

     I have binded a ViewModel to button which is having command to show the UserControl. What effect needs to used here to have a drop down effect for a user control and How i can dynamically place the user control below the button in WPF?

    Thanks,
    IamHuM
    Friday, August 15, 2014 10:01 AM

Answers


  • Hello,

    In my application, i have a user control (or a window) which i want to drop down (flow down) when user places a mouse on one of the button. How i can position the User control to get the drop down or flow down effect in the UI for the respective User Control. This effect should be reusable for the user control because location of button can be changed from one window to another.

     I have binded a ViewModel to button which is having command to show the UserControl. What effect needs to used here to have a drop down effect for a user control and How i can dynamically place the user control below the button in WPF?

    Thanks,
    IamHuM

    Binding it to listbox like this way http://stackoverflow.com/questions/19130943/wpf-adding-user-control-to-listbox

    For placing that listbox you could refer to http://stackoverflow.com/questions/5947559/c-sharp-wpf-how-to-set-location-width-and-height-of-the-controls-programatically

    And set listbox's visible to true when mouse hover.


    remember make the reply as answer and vote the reply as helpful if it helps.

    Monday, August 18, 2014 10:36 AM
  • When you say drop down.

    You mean like a combo?

    The drop down has to go over other controls?

    You could possibly just use a combo rather than a usercontrol and give it a new template with a button instead of the textbox and toggle button ( the arrow thingy ).

    Or a pop up with a list in it which you make visible on mouseover.

    <Popup IsOpen="{Binding ElementName=mybutton, Path=IsMouseOver,

    Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"

    AllowsTransparency="True"
            
    PopupAnimation="Slide" ............


    .

    If you can do stuff without creating a new usercontrol then that is often better since you avoid creating a new boundary you need to cross.



    Hope that helps
    Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


    Monday, August 18, 2014 10:51 AM

All replies


  • Hello,

    In my application, i have a user control (or a window) which i want to drop down (flow down) when user places a mouse on one of the button. How i can position the User control to get the drop down or flow down effect in the UI for the respective User Control. This effect should be reusable for the user control because location of button can be changed from one window to another.

     I have binded a ViewModel to button which is having command to show the UserControl. What effect needs to used here to have a drop down effect for a user control and How i can dynamically place the user control below the button in WPF?

    Thanks,
    IamHuM

    Binding it to listbox like this way http://stackoverflow.com/questions/19130943/wpf-adding-user-control-to-listbox

    For placing that listbox you could refer to http://stackoverflow.com/questions/5947559/c-sharp-wpf-how-to-set-location-width-and-height-of-the-controls-programatically

    And set listbox's visible to true when mouse hover.


    remember make the reply as answer and vote the reply as helpful if it helps.

    Monday, August 18, 2014 10:36 AM
  • When you say drop down.

    You mean like a combo?

    The drop down has to go over other controls?

    You could possibly just use a combo rather than a usercontrol and give it a new template with a button instead of the textbox and toggle button ( the arrow thingy ).

    Or a pop up with a list in it which you make visible on mouseover.

    <Popup IsOpen="{Binding ElementName=mybutton, Path=IsMouseOver,

    Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"

    AllowsTransparency="True"
            
    PopupAnimation="Slide" ............


    .

    If you can do stuff without creating a new usercontrol then that is often better since you avoid creating a new boundary you need to cross.



    Hope that helps
    Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.


    Monday, August 18, 2014 10:51 AM