TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rajesh Kumar
NA
39
12.6k
WPF Combobox Close When Click on Outside
May 27 2013 5:32 AM
Hi...
I would like to create custom control that will look like standard WPF
ComboBox
, but instead of instead of having an
ItemsPresenter
in the popup there will be another custom control. So, I created a new class that derives from
System.Windows.Controls.Control
, added a
IsDropDownOpen
property and created a style that is actually a copy of default
ComboBox
style (main idea is that the
Popup.IsOpen
and
ToggleButton.IsPressed
properties are bound to the
IsDropDownOpen
property of the control). The problem is that the Popup is not closed when I click outside of the control.
I took a look at the
ComboBox
class in the Reflector and found out that
ComboBox
used some logic to update the
IsDropDownOpen
property when it loses mouse capture. But that code uses some internal classes. Is there any alternative way to determine if the user clicked outside of the control and close the
Popup
?
Thanks
RAjesh
Reply
Answers (
1
)
C#, WPF and MVVM ... How to load an XML file into a dataset
Datagrid binding with multiple Collections using MVVM