The other day I was working with a series of TextBlock controls in a horizontally-oriented StackPanel. When I wanted some visible separation, I naturally chose the Separator control. When it didn’t show up, I was bemused and confused. This is getting to be a familiar place to be as I spelunk the deep caverns of WPF.
It took some digging, but I finally came across a workable solution:
<StackPanel Orientation="Horizontal"> <TextBlock Text="A" /> <Separator> <Separator.LayoutTransform> <RotateTransform Angle="90" /> </Separator.LayoutTransform> </Separator> <TextBlock Text="B" /> </StackPanel>It seems the Separator control is not set up to be "self righting" if the parent control has an alternate orientation. Thus the 90 degree twist. After this, the Separator shows as expected.
0 comments:
Post a Comment