Friday, 17 December 2010

Moving from WinForms to WPF

1) TabControl:

- How to set the title on the TabItem control?

In WinForms we used the Text property, in WPF we have the Header property. The header property is of type object, so basically we can put 'anything' in the header - not just text.

2) TextBox:

- How to add scrollbar to TextBox?

Add these properties: HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Auto"

3) Button:

- How to write a multi-line text on the button?

As expected this doesn't work
<Button.Content> Hello\rthere<Button.Content/>

We need to use a TextBlock as Content, and use a <LineBreak /> in the text.

For e.g.:
<TextBlock>Test<LineBreak/> button</TextBlock>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

C# Reactive Extensions - Buffer and Window

I was going through Buffer and Window in RX, thought a few examples would help clear the differences. First create a buffer of even numbe...