-2

I have some markup (from a Telerik Control Template). In that markup there is an ItemPresenter-element. I would like it (or rather, the content of it) to have Rounded corners.

With a button, you can get away with this to get rounded corners

<Button Content="Search" >
      <Button.Resources>
          <Style TargetType="Border">
              <Setter Property="CornerRadius" Value="3"/>
          </Style>
      </Button.Resources>
  </Button>

But this does not work on ItemPresenter. How can I achive this?

Cowborg
  • 2,645
  • 3
  • 34
  • 51
  • You can't do it directly, because an ItemsPresenter isn't a Framework element, and thus doesn't have a template. It's used solely in other templates to say "put your content here". To do this you'll have to template whatever control the ItemsPresenter is in. If you [extract that template](https://stackoverflow.com/questions/8825030/how-to-extract-default-control-template-in-visual-studio) and post it here then we should be able to help you. – Mark Feldman Jun 03 '20 at 11:00
  • What control are you trying to customize? – mm8 Jun 03 '20 at 13:42
  • @Mark: okthats what I was dreading, its a telerik control., I havent found the content of it _(yet), I ll have a look – Cowborg Jun 03 '20 at 14:03
  • @mm8: RadTabbedWindow from Telerik, I want the tabs to be rounded iat the top corners (as in Chrome for example) – Cowborg Jun 03 '20 at 14:03
  • You should still be able to extract the template, check out [this article on the Tekerik site](https://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-editing-control-templates). – Mark Feldman Jun 03 '20 at 21:59

1 Answers1

0

If you want to style the tabs in the header of the RadTabbedWindow, you should define a custom RadTabItem style that you set the ItemContainerStyle property of the RadTabbedWindow to, e.g.:

<telerik:RadTabbedWindow ...>
    <telerik:RadTabbedWindow.ItemContainerStyle>
        <Style TargetType="telerik:RadTabItem" BasedOn="{StaticResource RadTabbedWindowTabItemStyle}">
            <Setter Property="MinHeight" Value="40" />
            <Setter Property="Background" Value="Red" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="PinButtonVisibility" Value="Visible" />
            <Setter Property="CloseButtonVisibility" Value="Visible"/>
        </Style>
    </telerik:RadTabbedWindow.ItemContainerStyle>
    ...

</telerik:RadTabbedWindow>

If you want need to edit the ControlTemplate, which you most probably do to get rounded corners, you should be able to right-click on the control in design mode in Visual Studio or in Blend and choose Edit Additional Templates->Edit Generated Item Container (ItemContainerStyle) to copy the default template into your XAML markup. You could then edit it as per your requirements by for example setting the CornerRadius property of the Border element.

mm8
  • 163,881
  • 10
  • 57
  • 88