1

OK, I want to create a control that is like a Stackpanel with TextBlock on the left, something like:

Picture

The TextBlock need to be editable. So, the question is from whom I need to inherit to make that since cannot from Stackpanel?

1 Answer 1

5

That is basically a HeaderedItemsControl with a custom Template.

The template could be a Grid with two columns, one containing a rotated ContentPresenter which is bound to the header properties, on the right you would have an ItemsPresenter for the items.

e.g.

<Style TargetType="HeaderedItemsControl"> <!-- Implicitly applied --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="HeaderedItemsControl"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition /> </Grid.ColumnDefinitions> <ContentPresenter ContentSource="Header"> <ContentPresenter.LayoutTransform> <RotateTransform Angle="-90"/> </ContentPresenter.LayoutTransform> </ContentPresenter> <ItemsPresenter Grid.Column="1"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> 
<HeaderedItemsControl Header="Lorem Ipsum" ItemsSource="ABCDEF"/> 
Sign up to request clarification or add additional context in comments.

1 Comment

@PredragPejic: Added example, you might want to hook up some more properties using TemplateBindings

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.