相关文章推荐
小百科
›
Solved: WPF combobox selectionchanged event only on mouse click? | Experts Exchange
event
wpf
combobox
高大的泡面
1 年前
About
Pricing
Community
Teams
Start Free Trial
Log in
</div><div class="contentWrapper__CenterContent-sc-1fp29y7-5 hXBTnV"><div class="questionWrapper__QuestionSection-ir5t2q-0 eGMjXE"><div class="questionHeader__HeaderSection-sc-18y0a3b-0 IVqWl"><div class="questionHeader__MetaSection-sc-18y0a3b-2 bQOgkd"><div class="questionHeader__MetaLeft-sc-18y0a3b-3 hFLAY"><img src="https://filedb.experts-exchange.com/files/public/2013/11/18/7b86b728-3813-42c3-a757-e08ca0e4e9d9.png" alt="Avatar of xNejX"/></div><div class="questionHeader__MetaRight-sc-18y0a3b-4 engfSe"><style data-emotion="css g9cw6v">.css-g9cw6v{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}.css-g9cw6v>*:not(style)~*:not(style){margin-top:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-bottom:0px;-webkit-margin-start:var(--chakra-space-2);margin-inline-start:var(--chakra-space-2);}</style><div class="chakra-stack css-g9cw6v"><div class="author">xNejX</div><img alt="Flag for Canada" title="Canada" src="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/flags/4x3/ca.svg" style="display:inline-block;width:1em;height:1em;vertical-align:middle"/><p class="chakra-text css-0">asked on <time datetime="2010-11-22T12:30:42Z">11/22/2010</time></p></div><h1 class="questionHeader__Title-sc-18y0a3b-1 jLLeIg">WPF combobox selectionchanged event only on mouse click?</h1></div></div></div><div class="questionBodyWrapper__QuestionBodyWrapper-sc-57cwyz-0 jucnGB"><div id="q26630886" class="questionBody__BodyContent-q874ge-0 csPTmo wysiwyg-content"><div> Hi Guys,<br/> I have a ComboBox in my WPF xaml with some predefined ComboBoxItems. The ComboBox has the IsEditable enabled, so you can type in your username or select one from the predefined dropdown list of existing users on this system.<br/> When the user is selected I would like the focus to be transferred on the password field, but I'm having some difficulties with it since the combobox fires the selectionchanged event if i type in the first letter of a matching item in the ComboBoxItem or if I try to cycle through the predefined values using the up / down arrow keys. It's understandable that it does that since the selection of it has been changed, but I would like to know how could I filter my SelectionChanged event to pass the focus to my password input only if the user clicks on the item form the ComboBox, not if the item is autosuggested or cycled through with arrow keys. A good example of the user input field that I am trying to achieve is the Skype "Skype Name" component in the Skype Sign In screen.<br/> WPF xaml code:<br/> <pre><code class="code-1 nolinks" id="code-10-26630886-1"><span><ComboBox IsEditable="True" IsReadOnly="False" HorizontalAlignment="Left" Name="UserInput" Grid.ColumnSpan="2" " StaysOpenOnEdit="True" SelectionChanged="UserInput_SelectionChanged"></span> <span> <ComboBoxItem Content="test" /></span> <span> <ComboBoxItem Content="abc" /></span> <span> <ComboBoxItem Content="xyz" /></span> <span></ComboBox></span> </code></pre><p class="buttons csButton"><button name="codeSnippetId" type="button" class="button"><span>Select all</span></button><a href="/viewCodeSnippet.jsp?codeSnippetId=10-26630886-1" target="_blank" rel="noreferrer" class="button" title="Open in new window"><span>Open in new window</span></a></p> C# Code:<br/> <pre><code class="code-1 nolinks" id="code-10-26630886-2"><span>private void UserInput_SelectionChanged(object sender, SelectionChangedEventArgs e)</span> <span> PasswordInput.Focus();</span> </code></pre><p class="buttons csButton"><button name="codeSnippetId" type="button" class="button"><span>Select all</span></button><a href="/viewCodeSnippet.jsp?codeSnippetId=10-26630886-2" target="_blank" rel="noreferrer" class="button" title="Open in new window"><span>Open in new window</span></a></p> I've also tried the preview on key event returning the e.handled which worked fine, but it disabled the functionality of manually inputting a new value to the ComboBox:<br/> <pre><code class="code-1 nolinks" id="code-10-26630886-3"><span>private void UserInput_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)</span> <span> e.Handled = true;</span> </code></pre><p class="buttons csButton"><button name="codeSnippetId" type="button" class="button"><span>Select all</span></button><a href="/viewCodeSnippet.jsp?codeSnippetId=10-26630886-3" target="_blank" rel="noreferrer" class="button" title="Open in new window"><span>Open in new window</span></a></p> Thank you for your help, </div><div class="topicTags__TagsSection-sc-1axydhw-0 eOhgMg"><style data-emotion="css xllg9a">.css-xllg9a{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:top;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;font-weight:var(--chakra-fontWeights-medium);line-height:1.2;outline:0;min-height:1.5rem;min-width:1.5rem;font-size:var(--chakra-fontSizes-sm);border-radius:var(--chakra-radii-md);-webkit-padding-start:var(--chakra-space-2);padding-inline-start:var(--chakra-space-2);-webkit-padding-end:var(--chakra-space-2);padding-inline-end:var(--chakra-space-2);background:var(--chakra-colors-gray-100);color:var(--chakra-colors-gray-800);}.css-xllg9a:focus,.css-xllg9a[data-focus]{box-shadow:var(--chakra-shadows-outline);}</style><span class="css-xllg9a">C#</span><style data-emotion="css xllg9a">.css-xllg9a{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:top;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;font-weight:var(--chakra-fontWeights-medium);line-height:1.2;outline:0;min-height:1.5rem;min-width:1.5rem;font-size:var(--chakra-fontSizes-sm);border-radius:var(--chakra-radii-md);-webkit-padding-start:var(--chakra-space-2);padding-inline-start:var(--chakra-space-2);-webkit-padding-end:var(--chakra-space-2);padding-inline-end:var(--chakra-space-2);background:var(--chakra-colors-gray-100);color:var(--chakra-colors-gray-800);}.css-xllg9a:focus,.css-xllg9a[data-focus]{box-shadow:var(--chakra-shadows-outline);}</style><span class="css-xllg9a">.NET Programming</span><style data-emotion="css xllg9a">.css-xllg9a{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:top;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;max-width:100%;font-weight:var(--chakra-fontWeights-medium);line-height:1.2;outline:0;min-height:1.5rem;min-width:1.5rem;font-size:var(--chakra-fontSizes-sm);border-radius:var(--chakra-radii-md);-webkit-padding-start:var(--chakra-space-2);padding-inline-start:var(--chakra-space-2);-webkit-padding-end:var(--chakra-space-2);padding-inline-end:var(--chakra-space-2);background:var(--chakra-colors-gray-100);color:var(--chakra-colors-gray-800);}.css-xllg9a:focus,.css-xllg9a[data-focus]{box-shadow:var(--chakra-shadows-outline);}</style><span class="css-xllg9a">ASP.NET</span></div></div><div class="questionFooter__FooterSection-wcye1y-0 dQkQxi"><style data-emotion="css vy21t6">.css-vy21t6{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}.css-vy21t6>*:not(style)~*:not(style){margin-top:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-bottom:0px;-webkit-margin-start:5px;margin-inline-start:5px;}</style><div class="chakra-stack css-vy21t6"><style data-emotion="css 1vmjtia">.css-1vmjtia{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-transition:all 250ms;transition:all 250ms;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;white-space:nowrap;vertical-align:middle;outline:none;width:auto;line-height:1.2;border-radius:var(--chakra-radii-md);font-weight:var(--chakra-fontWeights-semibold);height:var(--chakra-sizes-8);min-width:var(--chakra-sizes-8);font-size:12px;-webkit-padding-start:var(--chakra-space-3);padding-inline-start:var(--chakra-space-3);-webkit-padding-end:var(--chakra-space-3);padding-inline-end:var(--chakra-space-3);background:inherit;margin-top:3px;cursor:pointer;}.css-1vmjtia:focus,.css-1vmjtia[data-focus]{box-shadow:0;}.css-1vmjtia[disabled],.css-1vmjtia[aria-disabled=true],.css-1vmjtia[data-disabled]{opacity:0.4;cursor:not-allowed;box-shadow:var(--chakra-shadows-none);}.css-1vmjtia:hover,.css-1vmjtia[data-hover]{background:none;}@media screen and (min-width: 30em){.css-1vmjtia{font-size:17px;}}.css-1vmjtia:active,.css-1vmjtia[data-active]{background:none;}@media screen and (max-width: 1146px){.css-1vmjtia{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;}}@media screen and (max-width: 1101px){.css-1vmjtia{-webkit-padding-start:inherit;padding-inline-start:inherit;-webkit-padding-end:inherit;padding-inline-end:inherit;}}</style><button type="button" class="chakra-button css-1vmjtia" title="Comments"><style data-emotion="css ktvjz1">.css-ktvjz1{-webkit-margin-end:0.5rem;margin-inline-end:0.5rem;}</style><span class="chakra-button__icon css-ktvjz1"><style data-emotion="css wfucoj">.css-wfucoj{width:var(--chakra-sizes-4);height:var(--chakra-sizes-4);display:inline-block;line-height:1em;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;color:700;vertical-align:middle;margin-top:-4px;margin-right:-6px;}@media screen and (min-width: 30em){.css-wfucoj{width:var(--chakra-sizes-5);height:var(--chakra-sizes-5);}}</style><svg viewbox="0 0 24 24" focusable="false" class="chakra-icon css-wfucoj" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none"><path d="M12 20C16.9706 20 21 16.4183 21 12C21 7.58172 16.9706 4 12 4C7.02944 4 3 7.58172 3 12C3 13.5743 3.51156 15.0423 4.39499 16.28L3 20L7.74467 19.0511C9.01172 19.6565 10.4607 20 12 20Z" stroke="#777" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></svg></span>3</button><style data-emotion="css 15p9n5u">.css-15p9n5u{height:24px;}</style><div class="css-15p9n5u"><style data-emotion="css u5l6o5">.css-u5l6o5{opacity:0.6;border:0;border-color:#9b9fa9;border-style:solid;border-left-width:1px;height:100%;}</style><hr aria-orientation="vertical" class="chakra-divider css-u5l6o5"/></div><style data-emotion="css 16k8png">.css-16k8png{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-transition:all 250ms;transition:all 250ms;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:relative;white-space:nowrap;vertical-align:middle;outline:none;width:auto;line-height:1.2;border-radius:var(--chakra-radii-md);font-weight:var(--chakra-fontWeights-semibold);height:var(--chakra-sizes-8);min-width:var(--chakra-sizes-8);font-size:12px;-webkit-padding-start:var(--chakra-space-3);padding-inline-start:var(--chakra-space-3);-webkit-padding-end:var(--chakra-space-3);padding-inline-end:var(--chakra-space-3);background:inherit;cursor:pointer;}.css-16k8png:focus,.css-16k8png[data-focus]{box-shadow:0;}.css-16k8png[disabled],.css-16k8png[aria-disabled=true],.css-16k8png[data-disabled]{opacity:0.4;cursor:not-allowed;box-shadow:var(--chakra-shadows-none);}.css-16k8png:hover,.css-16k8png[data-hover]{background:none;}@media screen and (min-width: 30em){.css-16k8png{font-size:17px;}}.css-16k8png:active,.css-16k8png[data-active]{background:none;}@media screen and (max-width: 1146px){.css-16k8png{-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;}}@media screen and (max-width: 1101px){.css-16k8png{-webkit-padding-start:inherit;padding-inline-start:inherit;-webkit-padding-end:inherit;padding-inline-end:inherit;}}</style><button type="button" class="chakra-button css-16k8png" title="Solutions"><span class="chakra-button__icon css-ktvjz1"><style data-emotion="css 8gliu5">.css-8gliu5{width:var(--chakra-sizes-4);height:var(--chakra-sizes-4);display:inline-block;line-height:1em;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;color:#1EA000;vertical-align:middle;margin-right:-6px;}@media screen and (min-width: 30em){.css-8gliu5{width:var(--chakra-sizes-5);height:var(--chakra-sizes-5);}}</style><svg viewbox="0 0 24 24" focusable="false" class="chakra-icon css-8gliu5" aria-hidden="true"><svg viewbox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.26701 1.45496C4.91008 1.40364 5.52057 1.15077 6.01158 0.732335C7.15738 -0.244112 8.84262 -0.244112 9.98842 0.732335C10.4794 1.15077 11.0899 1.40364 11.733 1.45496C13.2336 1.57471 14.4253 2.76636 14.545 4.26701C14.5964 4.91008 14.8492 5.52057 15.2677 6.01158C16.2441 7.15738 16.2441 8.84262 15.2677 9.98842C14.8492 10.4794 14.5964 11.0899 14.545 11.733C14.4253 13.2336 13.2336 14.4253 11.733 14.545C11.0899 14.5964 10.4794 14.8492 9.98842 15.2677C8.84262 16.2441 7.15738 16.2441 6.01158 15.2677C5.52057 14.8492 4.91008 14.5964 4.26701 14.545C2.76636 14.4253 1.57471 13.2336 1.45496 11.733C1.40364 11.0899 1.15077 10.4794 0.732335 9.98842C-0.244112 8.84262 -0.244112 7.15738 0.732335 6.01158C1.15077 5.52057 1.40364 4.91008 1.45496 4.26701C1.57471 2.76636 2.76636 1.57471 4.26701 1.45496ZM11.7071 6.70711C12.0976 6.31658 12.0976 5.68342 11.7071 5.29289C11.3166 4.90237 10.6834 4.90237 10.2929 5.29289L7 8.58579L5.70711 7.29289C5.31658 6.90237 4.68342 6.90237 4.29289 7.29289C3.90237 7.68342 3.90237 8.31658 4.29289 8.70711L6.29289 10.7071C6.68342 11.0976 7.31658 11.0976 7.70711 10.7071L11.7071 6.70711Z" fill="#078604"/></svg></svg></span>1</button><style data-emotion="css 17xejub">.css-17xejub{-webkit-flex:1;-ms-flex:1;flex:1;justify-self:stretch;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;}</style><div spacing="0" align="stretch" class="css-17xejub"/><style data-emotion="css 10jkc2x">.css-10jkc2x{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;height:45px;max-width:275px;padding-right:5px;}.css-10jkc2x>*:not(style)~*:not(style){margin-top:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-bottom:0px;-webkit-margin-start:0.5rem;margin-inline-start:0.5rem;}@media screen and (max-width: 1250px){.css-10jkc2x{padding-right:0px;}}</style><div class="chakra-stack css-10jkc2x"><div class="css-0"><img class="avatar" src="https://filedb.experts-exchange.com/files/public/2013/11/18/7b86b728-3813-42c3-a757-e08ca0e4e9d9.png" alt="Avatar of undefined"/></div><style data-emotion="css tmdwry">.css-tmdwry{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:start;-webkit-box-align:start;-ms-flex-align:start;align-items:start;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;height:75%;}.css-tmdwry>*:not(style)~*:not(style){margin-top:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;}</style><div class="chakra-stack css-tmdwry"><style data-emotion="css 1b4l9yh">.css-1b4l9yh{height:20px;color:var(--chakra-colors-gray-700);font-size:11px;font-weight:600;}</style><div class="css-1b4l9yh">Last Comment</div><style data-emotion="css 1wjumf6">.css-1wjumf6{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;font-size:11px;max-width:210px;height:10px;}.css-1wjumf6>*:not(style)~*:not(style){margin-top:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-bottom:0px;-webkit-margin-start:5px;margin-inline-start:5px;}@media screen and (max-width: 768px){.css-1wjumf6{max-width:175px;}}</style><div class="chakra-stack css-1wjumf6"><style data-emotion="css 1y32vh0">.css-1y32vh0{font-weight:600;color:var(--chakra-colors-blue-600);max-width:105px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}@media screen and (max-width: 1160px){.css-1y32vh0{max-width:80px;}}</style><div class="css-1y32vh0">xNejX</div><style data-emotion="css 1kp9ddg">.css-1kp9ddg{opacity:0.6;border:0;border-color:var(--chakra-colors-gray-700);border-style:solid;border-left-width:1px;height:100%;}</style><hr aria-orientation="vertical" class="chakra-divider css-1kp9ddg"/><div class="questionFooter__TimeDisplayWrap-wcye1y-1 jKYDiG">8/22/2022 - Mon</div></div></div></div></div></div></div><div id="a34187569" class="commentCard__CardWrapper-urxmpo-0 mugGS commentCard"><div class="commentCard__AuthorWrapper-urxmpo-3 kUYDQw"><div class="commentCard__MetaSection-urxmpo-1 cDLsha"><div class="lazyload-wrapper "><div style="height:30px" class="lazyload-placeholder"/></div><div class="commentCard__MetaRight-urxmpo-2 haCfBO"><div class="css-0"><div class="metaSubWrap css-0"><div title="Daniel Van Der Werken" class="nameDisplay">Daniel Van Der Werken</div><div class="lazyload-wrapper "><div style="height:24px" class="lazyload-placeholder"/></div><style data-emotion="css 1b08fi0">.css-1b08fi0{height:12px;}</style><div class="metaDivider css-1b08fi0"><style data-emotion="css 1bdoq9b">.css-1bdoq9b{opacity:0.6;border:0;border-color:#2C2E31;border-style:solid;border-left-width:1px;height:100%;}</style><hr aria-orientation="vertical" class="chakra-divider css-1bdoq9b"/></div><time datetime="2010-11-22T13:11:23Z" class="submitDate">11/22/2010</time></div><style data-emotion="css 1fdnm9k">.css-1fdnm9k{cursor:default;margin-left:5px;}</style><button class="certifiedExpertBadge css-1fdnm9k" expertstatus="CERTIFIED_EXPERT"><svg width="59" height="18" viewbox="0 0 59 18" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1157_14944)"><path d="M3.6875 0.5H55.3125C57.065 0.5 58.5 1.94712 58.5 3.75V14.25C58.5 16.0529 57.065 17.5 55.3125 17.5H3.6875C1.93498 17.5 0.5 16.0529 0.5 14.25V3.75C0.5 1.94712 1.93498 0.5 3.6875 0.5Z" fill="url(#paint0_linear_1157_14944)" stroke="#65C7FF"/><path d="M18.6436 12.75V5.92505H23.0311V7.09505H19.9306V8.7233H22.7581V9.8933H19.9306V11.58H23.0896V12.75H18.6436Z" fill="#222222"/><path d="M23.6132 12.75L25.6119 9.3083L23.6327 5.92505H25.0952L26.4504 8.3918H26.6259L27.9812 5.92505H29.4437L27.4644 9.3083L29.4632 12.75H28.0007L26.6259 10.2248H26.4504L25.0757 12.75H23.6132Z" fill="#222222"/><path d="M30.3169 12.75V5.92505H33.1249C33.5539 5.92505 33.9308 6.0128 34.2559 6.1883C34.5874 6.3573 34.8441 6.5978 35.0261 6.9098C35.2146 7.2218 35.3089 7.5923 35.3089 8.0213V8.1578C35.3089 8.58027 35.2114 8.95077 35.0164 9.2693C34.8278 9.5813 34.5679 9.82505 34.2364 10.0005C33.9113 10.1695 33.5408 10.254 33.1249 10.254H31.6039V12.75H30.3169ZM31.6039 9.08405H32.9981C33.3036 9.08405 33.5506 8.99952 33.7391 8.83055C33.9276 8.66157 34.0219 8.4308 34.0219 8.1383V8.0408C34.0219 7.7483 33.9276 7.51752 33.7391 7.34855C33.5506 7.17955 33.3036 7.09505 32.9981 7.09505H31.6039V9.08405Z" fill="#222222"/><path d="M36.2012 12.75V5.92505H40.5887V7.09505H37.4882V8.7233H40.3157V9.8933H37.4882V11.58H40.6472V12.75H36.2012Z" fill="#222222"/><path d="M41.5999 12.75V5.92505H44.5639C44.9929 5.92505 45.3666 5.9998 45.6851 6.1493C46.0036 6.2988 46.2506 6.51005 46.4261 6.78305C46.6016 7.05605 46.6894 7.3778 46.6894 7.7483V7.8653C46.6894 8.2748 46.5919 8.6063 46.3969 8.8598C46.2019 9.1133 45.9613 9.29855 45.6754 9.41555V9.59105C45.9354 9.60402 46.1368 9.69507 46.2799 9.86405C46.4229 10.0266 46.4944 10.2443 46.4944 10.5173V12.75H45.2074V10.7025C45.2074 10.5465 45.1651 10.4198 45.0806 10.3223C45.0026 10.2248 44.8693 10.176 44.6809 10.176H42.8869V12.75H41.5999ZM42.8869 9.00605H44.4274C44.7328 9.00605 44.9701 8.92482 45.1391 8.7623C45.3146 8.59332 45.4024 8.3723 45.4024 8.0993V8.0018C45.4024 7.7288 45.3178 7.51107 45.1489 7.34855C44.9799 7.17955 44.7394 7.09505 44.4274 7.09505H42.8869V9.00605Z" fill="#222222"/><path d="M49.2255 12.75V7.09505H47.2365V5.92505H52.5015V7.09505H50.5125V12.75H49.2255Z" fill="#222222"/><path d="M10.8597 7.50769C10.8597 7.50769 11.6581 8.50571 10.9159 9.5894C10.5257 9.57308 8.52122 9.39768 8.52122 9.39768C8.52122 9.39768 7.79992 9.38068 7.70543 9.88785C7.61094 10.395 7 13.5087 7 13.5087C7 13.5087 7 14.0343 7.63113 13.9982C8.26227 13.9622 10.2855 13.7011 10.2855 13.7011C10.2855 13.7011 10.7666 13.5087 10.8236 13.1573C10.8806 12.8058 11.0833 10.2183 11.0833 10.2183C11.0833 10.2183 11.3429 9.85182 12.0851 9.81579C12.8274 9.77975 12.8649 10.0259 12.8649 10.0259C12.8649 10.0259 12.937 10.3236 12.9197 10.4814C12.9024 10.6391 12.8274 13.0532 12.8274 13.0532C12.8274 13.0532 12.9197 13.385 13.2544 13.3673C13.589 13.3497 14.7395 13.1926 14.7395 13.1926C14.8212 13.1585 14.8898 13.1017 14.9363 13.0297C14.9827 12.9578 15.0046 12.8742 14.9992 12.7901C14.9992 12.4747 14.9076 10.4453 14.9076 10.4453C14.9076 10.4453 14.8874 10.0959 14.5541 10.0442C14.2209 9.99255 13.6071 9.94088 13.6071 9.94088C13.6071 9.94088 13.3654 9.92456 13.3474 9.50441C13.3294 9.08427 13.4195 8.3677 13.4195 8.3677C13.4195 8.3677 13.5696 8.12296 13.8098 8.13927C14.05 8.15559 14.5534 8.33167 14.5534 8.33167C14.5534 8.33167 14.7568 8.33167 14.7763 8.1923C14.7958 8.05293 14.72 6.37302 14.72 6.37302C14.7051 6.28267 14.6668 6.19716 14.6086 6.12402C14.5504 6.05087 14.4739 5.99234 14.3861 5.95355C14.0882 5.8305 13.3647 5.56808 13.3647 5.56808C13.3647 5.56808 12.994 5.43211 12.994 5.70813C12.994 5.98415 12.9384 7.68445 12.9384 7.68445C12.9384 7.68445 12.9384 7.8245 12.5857 7.78983C12.5857 7.78983 11.7505 7.77283 11.3047 7.26498C11.3235 6.65312 11.472 5.09626 11.472 5.09626C11.472 5.09626 11.3235 4.76313 11.0263 4.65844C10.7291 4.55374 9.34061 4.02618 9.34061 4.02618C9.34061 4.02618 8.85878 3.88613 8.78449 4.25393C8.7102 4.62172 8.33873 6.59805 8.33873 6.59805C8.33873 6.59805 8.45053 6.96449 8.76574 7.03588C9.08094 7.10726 10.8597 7.50769 10.8597 7.50769Z" fill="#222222"/></g><defs><lineargradient id="paint0_linear_1157_14944" x1="1" y1="9.99999" x2="59" y2="10" gradientunits="userSpaceOnUse"><stop stop-color="#A3DCF9"/><stop offset="0.393355" stop-color="#DFF2FF"/><stop offset="1" stop-color="#A3DCF9"/></lineargradient><clippath id="clip0_1157_14944"><rect width="59" height="18" fill="white"/></clippath></defs></svg></button></div></div></div></div><div class="commentBody__CommentBodyWrapper-qtsrh5-0 fhlaeB wysiwyg-content"><div class="content wysiwyg-content fr-view"><div> I don't have WPF on my system, but I think I know what you're talking about and might offer a suggestion.<br/> What I would do is set the OnMouseDown event for the combo box itself and then set a class-wide static bool variable to true if the mouse button was pushed while the cursor was over the combo box.<br/> Then, in the OnSelectionChanged event, I'd check to see if the mouse had been previously pushed down. If so, then I'd do the move to the password box. <br/> Make sure to reset the bool value to false as appropriate. You might have to tinker around with it. Anyway, that's what I'd do. There might be a more elegant solution.
推荐文章