Control Template or Custom Dependency property

I have a checkbox control which is templated as follows:

Here is the XAML snippet of the checkbox:

<CheckBox Grid.Row="0" 
          Grid.Column="1" 
          Width="62"
          VerticalAlignment="Center"
          HorizontalAlignment="Left"
          IsChecked="{Binding IncludeBlueTrades}"
          Style="{StaticResource ToggleSwitchCheckBox}"/>

Currently the Values: Buy and Sell are hardcoded into the Style. I want to get them configurable so that the checkbox can pass this values. Basically everytime I want to use the checkbox as a slider - I should be able to pass the values from XAML - something like below:

<CheckBox Grid.Row="0" 
          Grid.Column="1" 
          Width="62"
          VerticalAlignment="Center"
          HorizontalAlignment="Left"
          ValueOn = "Buy"
          ValueOff = "Sell"
          IsChecked="{Binding IncludeBlueTrades}"
          Style="{StaticResource ToggleSwitchCheckBox}"/>

I understand the concepts of Template Binding (which has to be used in Control Template) and custom controls. What I am confused here is which one should I use to get the achieved result. I think it has to be custom dependency property - but not 100 % sure.

I can post the style code is necessary. Can someone please help me with code snippet and direction.

Thanks

Answers


Need Your Help

GUI admin tool for managing production processes

production-environment system-administration production-support gui-tools

I have several shell scripts, perl and java based processes running on a bunch of unix machines.

How do I specify a multiline title in an iOS Settings bundle?

iphone ios settings.bundle

I have added a Settings.bundle to my iOS application. One of my settings is a toggle switch with a long title. This title is getting truncated.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.