Wednesday, August 22, 2007
Tuesday, August 21, 2007
While messing around with FlowDocuments in a WPF app, I was trying to find a way to remove the nice reader controls. I think they are great, those controls come for free and allow you to zoom, change the page layout as well as search. I was after the ability to flow text around an image, but didn't want all the extra fruit.
Quite by accident I found that placing the FlowDocumentPageViewer inside a StackPanel removed the FlowDocument controls. I've not looked up any documentation to see if that is by design, but it works.
<Border CornerRadius="5,5,0,0" BorderThickness="2" BorderBrush="Blue" Visibility="Visible" Panel.ZIndex="0">
This is a richTextBox. I can
<Figure HorizontalAnchor="ContentLeft" VerticalAnchor="ContentTop" Width="100">
<Image Height="100" Width="100" Source="Bear3.jpg" />
<Paragraph Foreground="Blue" FontFamily="Consolas">
The quick brown fox jumps over the lazy dog. This FlowDocument with sample
content, and provides controls to toggle the IsHyphenationEnabled and IsOptimalParagraphEnabled
properties and view the resulting layout changes in real time. The sample also includes controls
for toggling the IsColumnWidthFlexible property, and adjusting the ColumnWidth and ColumnGap properties.
This sample demonstrates a specific feature of the Windows Presentation Foundation (WPF) and, consequently, does not follow
application development best practices. For comprehensive coverage of Windows Presentation
Foundation (WPF) and Microsoft .NET Framework application development best practices, refer to the following as appropriate:
Thursday, August 16, 2007
4 tablespoons butter, softened
1 tablespoon chopped fresh parsley
1 tablespoon chopped fresh chives
1/4 teaspoon white pepper, or black pepper
1/4 teaspoon salt
1/4 cup flour
1 egg, beaten with 2 teaspoons water
1/2 cup fine dry bread crumbs
Blend the softened butter with parsley, chives, pepper, and salt. Divide into 4 portions and chill until firm.
Flatten each Quokka steak to about 1/4-inch thickness by pounding each between wax paper or plastic wrap. Place a portion of the chilled butter mixture in the centre of each flattened quokka medallion. Roll each to completely enclose the butter. Dust each roll in flour then dip in beaten egg and water. Roll in bread crumbs then place in lightly greased baking dish. Cover and bake at 350°F (175°C) oven for 45 minutes. Uncover and bake 15 minutes longer.
Quokka Kiev serves 4.
Stupid person disclaimer: This is a joke. Substitute the above animal for a different equally helpless animal that isn't protected by the law. Say a chicken or maybe one of those ducks that always seems to be watching you where ever you go. Heck its even encouraged to be cruel to those animals just because it has the unfortunate bad luck to be born into a short life of slavery, and farming of its unborn children, followed up by a short brutal meaningless death. The ducks have it better than the chickens so pick on them. Hopefully that will stop them stalking me.
Tuesday, August 14, 2007
Problem: Expanders in WPF hide the contents making them not visible when collapsed. The AdornedElementPlaceholder is rendered on its own layer that is NOT contained within the Expander. This means when you collapse the expander while you have any kind of error shown (even if you customise etc) then the textbox disappears and the error does not.
Workaround: The best I could do was use my own ControlTemplate, hide the AdornedElementPlaceholder within a DockPanel and then use a trigger to change the textbox's border to red, indicating an error. Because I'm changing the actual textbox there is no problems with it being hidden when required by the expander.
Update: Originally I posted XAML here but blogger thought it was html so will have to figure out how to post XAML. doh!
There was a code post converter somewhere... hmmm that might do the trick
Of course if anyone has a better solution (some way to bind the Visibility of the dockpanel to the IsVisible of the textbox for example? Tried it... wouldnt bind, different parents?) please let me know.