Checked status not updated in CheckBox template?

By adding text in the TextBlock element as content, you're setting a local value on the Text property. Local values override values set by triggers, so your trigger will have no effect. See this StackOverflow question or Dependency Property Value Precedence on msdn.

Up vote 1 down vote favorite share g+ share fb share tw.

I'm trying to create an hyperlink that changes its text depending on a boolean value. I thought I could leverage the IsChecked method of a CheckBox. So I wrote this ControlTemplate for a CheckBox: Unchecked But when I click on the hyperlink, nothing happens.

The checked status is not changed and the Text property of the TextBlock is not updated. Any ideas? C# .net wpf checkbox control-template link|improve this question edited Jun 13 '10 at 11:18 asked Jun 13 '10 at 10:51Simon3,204417 100% accept rate.

By adding text in the TextBlock element as content, you're setting a local value on the Text property. Local values override values set by triggers, so your trigger will have no effect. See this StackOverflow question or Dependency Property Value Precedence on msdn.

If you set the Text property instead of adding it as content, it will be considered a parent template property set and be lower precedence than the parent template trigger: Also, it sounds like you're only using a CheckBox because you want a trigger based on a Boolean property. You could use a DataTrigger instead of a Trigger to bind to a property on your DataContext instead of a property on your control, or you could just bind the Text property directly to SomeBool and use a value converter that converts true and false to "Checked" and "Unchecked".

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions