Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5992019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:28:16+00:00 2026-05-22T23:28:16+00:00

So, hello everybody. I’ve made two test programs for creating a own control. One

  • 0

So, hello everybody.

I’ve made two test programs for creating a own control. One in Silverlight, one in WPF. I created a kind of RangeSlider. This Slider has of course two Orientations, Horizontal and Vertical.
First I used two different techniques to create my RangeSlider. In WPF I used Triggers, in Silverlight (u know there arent Triggers) I changed the Visibility of the Horizontal and Vertical Template in CodeBehind.This runs.

Now:
I’m trying to use one technique for both, Silverlight and WPF. Therefore I use VisualStateManager.

I’ve a Template defining two Sliders (one for left value, the other for right value). Simplified on the important values it looks like that:

...
<ControlTemplate>
  <Grid x:Name="PART_Content">
    <!-- VSM: See following code sequence -->
    <Grid x:Name="PART_HorizontalTemplate">
      <Slider x:Name="PART_HorizontalSliderLeft"
              Template="{StaticResource HorizontalSliderTemplate}"
              Orientation="{TemplateBinding Orientation}" />
      ...
    </Grid>
    <Grid x:Name="PART_VerticalTemplate">
      ...
    </Grid>
  </Grid>
</ControlTemplate>

Additionally there is the VSM to switch between Horizontal and Vertical look:

<VisualStateManager.VisualStateGroups>
  <VisualStateGroup>
    <VisualState x:Name="Vertical">
      <Storyboard>
        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_HorizontalTemplate"
                                       Storyboard.TargetProperty="Visibility">
          <DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0"/>
        </ObjectAnimationUsingKeyFrames>
      </Storyboard>
    </VisualState>
    <VisualState x:Name="Horizontal" />
  </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

This still runs.

As you see in the code sequence, the visual of Slider is defined by a Template, here HorizontalSliderTemplate (I reduce code again):

<ControlTemplate x:Key="HorizontalSliderTemplate" TargetType="{x:Type Slider}">
  <Border x:Name="Border" ...>
    <!-- VSM here. Like above. -->
    <Grid x:Name="Grid">
      <Rectangle x:Name="PART_SelectionRange"/>
      <Track x:Name="PART_Track">
        ...
      </Track>
    </Grid>
  </Border>
</ControlTemplate>

Actually there is also a VerticalSliderTemplate.
But I want to combine both ControlTemplate in one Template and use VSM. Here we come to my problem:

I do not get running the VSM in the ‘inner’ ControlTemplate. It’s nearly the same code as the running VSM-Part, just the TargetName is changed. I do not know how to debug what’s running on GoToState, but I believe the VSM in the template is never found and from there never execute.

I can imagine that there’s just a little detail missing, but I ‘cant see the wood for the trees’. Maybe there is an important thing what I do not know about Templates or about VSM, and I’m off the track.
Or do I have to trigger the ‘inner’ VSM from outside, or there’s a possibility to access onto Elements from ‘outside VSM’?
Or is there no access on VSM in ‘inner’ Templates?

I hope I could explain my problem good enough and there is someone, who knows a solution or maybe a keyword what I can look for. Just entering keywords VSM, ControlTemplate, Storyboard, etc. in google gives no helping hand.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:28:17+00:00Added an answer on May 22, 2026 at 11:28 pm

    So, I got a solution on it.
    In the ‘inner’ template I added to the element I want to toggle a DataTrigger. This DataTrigger is bound to the PART_HorizontalTemplate Visibility and contains a Storyboard that do the action I need.

    Maybe it’s not really the kind of solution I was looking for, because it stretches the code a lot and makes it therefore looking more complex. But – and thats most important – it runs well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I have two dependants select box, the second one is popularited after onchange
Hello everyBody I've created a slideShow (with left and right arrows) , displaying images
Hello everybody and Merry Christmas, I've created some li elements in a news website,
Hello everyBody I've created a slideShow (with left and right arrows) , displaying images
Hello everybody and Merry Christmas, I've created some li elements in a news website,
Hello everybody and thanks for your time. I'm developing some kind of monitoring application
Hello everybody I'm trying to make my own web site with framework JBoss Netty,
Hello can anybody solve this please I'm creating the object in the action class
Hello there and Merry Christmas !!! I am new to WPF and I am
Hello everybody I'm trying to replace the 'text' input type to 'password' . And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.