January 2009 - Posts
My blog has moved!
Please invest a couple of minutes to update your feed subscription.
The new location:
http://blogs.microsoft.co.il/blogs/zuker
Syndication link: http://feeds.feedburner.com/ZukerOnFoundationsMs
See you there ;)
It took me quite a while to find a proper example of how to communicate with SQL Reporting Services in order to execute a specific report, I though I might share it.
We have Report Server 2008 installed over SQL Server 2005.
I needed to extract data of a specific report in runtime (desired output in my case - XML).
I found 2 suitable ways of doing so:
1) Use ReportExecution2005 Service
SQL Reporting Services include the following:
ReportService2005 - A service which exposes the realm of the entire reports
ReportService2006 - Represents the SharePoint integration mode
ReportExecution2005 - A service used to execute reports - my main focus.
TalkWithWs() method in the attached project illustrates the use of the ReportExecution2005 service.
2) Use the Report Server ReportViewer page directly
This is a very easy way to extract the data.
I could extract any report's data through the ReportViewer page, E.g.
http://<Server>/<ReportServer Instance>/Pages/ReportViewer.aspx?%2fSandBox%2fadv_testforAmir&rs:Command=Render&rs:Format=xml
This will yield the XML data for the following report path: /SandBox/adv_testforAmir
Very clean and handy.
This mechanism also support parameters (through the QueryString)
The source code is attached.
In order to view the attached files, make sure you enter the specifc post page.
In continuation to my first post -
WPF Popups and ToolTip behavior - A Journey
I decided to approach the implementation of such a popup like the ToolTip and ContextMenu are doing it themselves.
I did not inherit from Popup but rather created my own control and I used the Popup.CreateRootPopup which sets the Popup.Child property to my control and it picks up on all the ToolTipService properties defined on my control.
I started from reading the following post:
Popup your control
There were some problems with this pattern though, I had to overcome these with quite many event hooking which I'm not very happy about. At least it works for now :)
There is a way to improve the implementation, I could use mouse capturing but that introduced another set of problems so I left it as it is for the time being.
I will post my solution soon enough.
Someone asked me what the difference between descendants and elements is, I thought I'd post the details here for common interest.
Descendants will yield you elements of your choice from the entire source element sub-tree, whereas Elements will yield the child elements only.
E.g.
string xml = @"
<Root>
<Item>
<id>1</id>
</Item>
<Item>
<id>2</id>
</Item>
<Item>
<id>3</id>
<Items>
<Item>
<id>5</id>
</Item>
<Item>
<id>6</id>
</Item>
</Items>
</Item>
<Item>
<id>4</id>
</Item>
</Root>";
XDocument doc1 = XDocument.Parse(xml);
var q1 = from e in doc1.Root.Descendants("Item")
select e;
var q2 = from e in doc1.Root.Elements("Item")
select e;
int c1 = q1.Count(); //6
int c2 = q2.Count(); //4
I am currently working on a WPF project which I needed a ToolTip with a certain behavior:
- It should act like a ToolTip
- Support content template
- Appear upon hovering with a small interval
- Appear once - hovering another element with a tooltip should hide the last shown tooltip.
- Support Rich Content
The latter is marked as bold since that was the essential requirement that made me not use the ordinary WPF ToolTip.
I needed the ToolTip to hold rich content - such as clickable buttons.
This also implicates that I wanted the ToolTip to remain shown until either one of the following
- The window was moved/size changed
- The window was deactivated (E.g. Alt+Tab)
- A click was made outside the boundary of the shown tooltip
- Otherwise - Keep being shown! - Unsupported by the built-in ToolTip.
I went over and examined my possibilities along with my close friend Aelij Arbel who worked together with me on this.
The options we were considering are as follows:
1) Built-in ToolTip - As indicated above - unsuitable.
2) Context Menu - The behavior I was looking for resembled the Context-Menu behavior, so I thought about perhaps I could template the Context menu to look like I wanted and try to change it's core Right-Click functionality but it turned out to be quite complicated and I'm unsure it's possible.
3) Use Popup - Popup is a great thing. It allows you to place content apart from the window Visual Tree - floating.
It supports most of the ToolTip placement properties which I needed - Let the popup control the placement positioning, take a lot of pain off my back.
Obviously, the third way appeared to be the best way to go.
Good news - Popups did do the trick I needed. However, they wouldn't work properly in some cases.
Unfortunately, bad news - It didn't in my case.
I attached a project sample showing some behavior disfunctions in the Popup, just so you see for yourself there are issues with that.
That was the starting point of my journey - I was going to create such RichToolTipPopup behavior that would be supported in every case!
I will post about my solution in the following days.
In order to view the attached files, make sure you enter the specifc post page.