﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - DialogBoxServiceProvider</title><link>http://www.intersoftsolutions.com/Community/Tags/DialogBoxServiceProvider/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Problem with DialogBoxServiceProvider and GetFocusedElement() method</title><link>http://www.intersoftsolutions.com/Community/Tags/DialogBoxServiceProvider/</link><pubDate>Fri, 24 May 2013 14:23:20 GMT</pubDate><dc:creator>BillGower</dc:creator><category>DialogBoxServiceProvider</category><description>&lt;p&gt;I am using the DialogBoxServiceProvider in my Wpf application. In the CloseCurrentWindow() method, the code is as follows:&lt;/p&gt;&lt;pre style="font-family: consolas; font-size: 13px; background-color: white;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;FrameworkElement&lt;/span&gt;element=&lt;span style="color: rgb(43, 145, 175);"&gt;ISFocusManager&lt;/span&gt;.GetFocusedElement()&lt;span style="color: blue;"&gt;as&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;FrameworkElement&lt;/span&gt;;
&lt;span style="color: rgb(43, 145, 175);"&gt;IWindow&lt;/span&gt;window=&lt;span style="color: rgb(43, 145, 175);"&gt;UXWindow&lt;/span&gt;.GetWindowHost(element);
 
&lt;span style="color: blue;"&gt;if&lt;/span&gt;(window!=&lt;span style="color: blue;"&gt;null&lt;/span&gt;)
window.Close();&lt;/pre&gt;&lt;p&gt;When the user clicks the Save button on the dialog box, the save button is the GetFocusedElement and the dialog box successfully closes. I have a Close Batch button which is a UXToolBarButton in a UXToolGroup on a UXToolBar. When the user clicks the Close Batch, the code calls the DialogBoxServiceProvider.CloseCurrentWindow() method. The application crashes because GetFocusElement returns null. Why is a button on the UXDialogBox recognized as a FrameworkElement, but the button on the toolbar is not. Is that a bug? If not, how do i get the button on the tool bar to be returned as a frameworkElement like the save button?&lt;/p&gt;</description></item></channel></rss>