Tuesday, December 2, 2008
Little tidbits about Silverlight 2.0
1. The resource dictionary must be named "generic.xaml".
2. It should be placed in "Themes" directory.
You do that .... you are golden .....
Cheers !!!
Friday, November 21, 2008
Silverlight 2.0 and Textbox control that understands TAB key
So here is what we did. First we wrote our custom component which extends a regular TextBox. By default we set it's "AcceptsReturn" field true. Then we wrote a simple function named "HandleTab()" which will insert a Tab ("\t") character at the place of the cursor.
After you are done there, now what is remaining is to capture the "Tab" key press event. This needs to be on the container and not on the control itself. Unfortunately onKeyUp event does not capture the Tab key so we need to do it in onKeyDown event handler. Obviously we would want to capture this event for just our text box & that too on the "TAB" key, we will do the following:
============================================
void tb_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key.Equals(Key.Tab))
{
if (e.OriginalSource.GetType().Equals(typeof(CodeTextBox)))
{
(e.OriginalSource as CodeTextBox).HandleTab();
e.Handled = true;//prevent further propagation
}
}
}
=======================================================
and here is the code for HandleTab() function
----------------------------------------------
public class CodeTextBox : TextBox
{
public CodeTextBox()
{
this.AcceptsReturn = true;
}
public void HandleTab()
{
string tbText = this.Text;
int cursorPosition = this.SelectionStart;
int contentLength = tbText.Length; if (cursorPosition >= contentLength)
{
this.Text = tbText + "\t";
}
else
{
string leftSideContent = tbText.Substring(0, cursorPosition);
string rightSideContent = tbText.Substring(cursorPosition);
this.Text = leftSideContent + "\t" + rightSideContent;
}
this.SelectionStart = cursorPosition + 1;
}
}
============================================
This is pretty basic stuff but I think it can get the job done. Shift+Tab is yet to be implemented.
Also I don't know why but when you [Tab] does not insert 8 characters like you would normally expect. However when you copy the tabbed code from this textbox to your notepad or any other windows application, you see text as you would normally see. Any ideas?
Any comments??
Enjoy!!!
Sunday, October 26, 2008
In the office now
Thursday, September 11, 2008
Safari Books Online
So I wanted to subscribe for Safari Books Online. If you don't know what Safari Books is, I would recommend that you visit http://www.safaribooksonline.com/. Anyways they offer two products for individual subscription: Safari Library (expensive & good one) and Safari Bookshelf (cheap & not so good one). When I went to sign up on their site, to my surprise I did not get an option to subscribe for Safari Library. In response to a ticket submitted to their customer support, I got a response "India is not one of the country they offer Safari Library". This makes me wonder the country which produces most of the IT talent is not in the list of countries that can have access to Safari Library subscription.
Huh!!! Go Figure!!!
P.S. There is a catch here and people in India can still subscribe to safari library if they want to. All they have to do is log on to a VPN network in the US (like I did) and get a US IP address and you will see an option to choose Safari Library.
Tuesday, September 9, 2008
Omega.MSSQL
- Supports SQL Server 2008, 2005 & 2000 out of the box.
- Allows you to create/alter/drop most of the common database objects (Tables, Views, etc.). It has a designer features for objects like User Defined Table Types which is not available in any tool at this time.
- Allows you to search for meta data - This is one of the coolest features available in this product. Have you ever wondered where all a column by certain name is used in your database (try finding it in Enterprise Manager or You end up writing your own scripts)? Well Omega.MSSQL makes it easy for you. You just type in what you are looking for and where you want to search (tables, views, stored procedure etc.) and Omega.MSSQL will give you a list of all the objects grouped by object type.
- Allows you to document the database.
- Allows you to build and execute queries. This is a feature where we need to do some improvements but we are eagerly waiting for Silverlight 2.0 and then we will probably porting the software from there.
Anyways check it out. URL is http://omega.cerebrata.com. This is currently in its final Beta Stages. We hope to release it in production in next few months.
Monday, September 8, 2008
Back in India
Cheers!!!