Question

Content for Splitter

Posted 6 years ago by Avatar sean hopen
How can I put a little graphic on the splitter so the user has a cue that it's there?

Comments (8)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Sean,

You could do this by making a Style that sets a new Template for docking:Splitter.

Actipro Software Support
Posted 6 years ago by sean hopen
Thanks. that's what I was trying to do.

I usually edit a template by right-clicking in Blend and selecting "Edit Template"
Since the splitter doesn't actually appear in the layout (just SplitContainer), I don't know how to reference it.

Sorry if that's a silly WPF question, but some guidance here would be most welcome.
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
You'd just put something like this in your Application.Resources:
<Style x:Key="{x:Type docking:Splitter}" TargetType="{x:Type docking:Splitter}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type docking:Splitter}">
        ... template code here ...
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Actipro Software Support
Posted 6 years ago by sean hopen
Interesting. I guess by setting the key to the type it overrides for all objects of that type. I was looking for a place to set a style, but couldn't find any Splitter property.

I did try your suggestion:
<Style x:Key="{x:Type docking:Splitter}" TargetType="{x:Type docking:Splitter}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type docking:Splitter}">
                <Grid Width="Auto" Height="Auto" >
                    <Rectangle Width="25" Height="5" Fill="HotPink"></Rectangle>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
It compiles but I see no change in the splitter.
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
My apologies... make two changes. Take out the x:Key and change the Style's TargetType to be docking:ContainerSplitter instead of docking:Splitter. That should work.

Actipro Software Support
Posted 6 years ago by sean hopen
Compiler doesn't like the Property="Template"
It looks like SplitContainer doesn't have a public Template.
        
<Style TargetType="{x:Type docking:SplitContainer}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type docking:Splitter}">
                <Grid Width="Auto" Height="Auto" >
                    <Rectangle Width="25" Height="5" Fill="HotPink"></Rectangle>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Sean, it's docking:ContainerSplitter, not docking:SplitContainer.

Actipro Software Support
Posted 6 years ago by sean hopen
Sorry, i thought you typo'd. That works.
        <Style TargetType="{x:Type docking:ContainerSplitter}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type docking:Splitter}">
                        <Grid Width="Auto" Height="Auto" >
                            <Rectangle Width="25" Height="5" Fill="HotPink"></Rectangle>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
Thanks!

[Modified at 01/09/2009 09:56 AM]
Information The latest build of this product (2014.2 build 0611) was released 7 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.