Click here to Skip to main content
15,915,703 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 0:50
mvePete O'Hanlon17-May-11 0:50 
GeneralRe: Binding problem Pin
DevUK17-May-11 0:56
DevUK17-May-11 0:56 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 1:01
mvePete O'Hanlon17-May-11 1:01 
GeneralRe: Binding problem Pin
Tarun.K.S17-May-11 2:21
Tarun.K.S17-May-11 2:21 
AnswerRe: Binding problem Pin
Abhinav S17-May-11 0:12
Abhinav S17-May-11 0:12 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 0:53
mvePete O'Hanlon17-May-11 0:53 
GeneralRe: Binding problem Pin
Abhinav S17-May-11 18:23
Abhinav S17-May-11 18:23 
GeneralRe: Binding problem Pin
Pete O'Hanlon17-May-11 20:28
mvePete O'Hanlon17-May-11 20:28 
AnswerRe: Binding problem Pin
yesotaso23-May-11 22:31
yesotaso23-May-11 22:31 
QuestionThread Issue: "Import" DrawingGroup Pin
Paul Selormey16-May-11 14:47
Paul Selormey16-May-11 14:47 
AnswerRe: Thread Issue: "Import" DrawingGroup Pin
Mark Salsbery16-May-11 15:44
Mark Salsbery16-May-11 15:44 
GeneralRe: Thread Issue: "Import" DrawingGroup Pin
Paul Selormey16-May-11 15:53
Paul Selormey16-May-11 15:53 
GeneralRe: Thread Issue: "Import" DrawingGroup Pin
Paul Selormey17-May-11 1:02
Paul Selormey17-May-11 1:02 
QuestionHow to modify DataTemplate programmatically? Pin
Tesic Goran16-May-11 1:24
professionalTesic Goran16-May-11 1:24 
AnswerRe: How to modify DataTemplate programmatically? Pin
Abhinav S16-May-11 2:04
Abhinav S16-May-11 2:04 
GeneralRe: How to modify DataTemplate programmatically? Pin
Tesic Goran16-May-11 2:35
professionalTesic Goran16-May-11 2:35 
AnswerRe: How to modify DataTemplate programmatically? Pin
Abhinav S16-May-11 3:10
Abhinav S16-May-11 3:10 
AnswerRe: How to modify DataTemplate programmatically? Pin
Mark Salsbery16-May-11 2:44
Mark Salsbery16-May-11 2:44 
GeneralRe: How to modify DataTemplate programmatically? Pin
Tesic Goran16-May-11 3:00
professionalTesic Goran16-May-11 3:00 
GeneralRe: How to modify DataTemplate programmatically? Pin
Mark Salsbery16-May-11 3:04
Mark Salsbery16-May-11 3:04 
AnswerRe: How to modify DataTemplate programmatically? Pin
SledgeHammer0116-May-11 6:21
SledgeHammer0116-May-11 6:21 
GeneralRe: How to modify DataTemplate programmatically? Pin
Tesic Goran17-May-11 1:24
professionalTesic Goran17-May-11 1:24 
GeneralRe: How to modify DataTemplate programmatically? Pin
Pete O'Hanlon17-May-11 1:54
mvePete O'Hanlon17-May-11 1:54 
Questionobjects added to an IDictionary must have a Key attribute [modified] Pin
Lutosław15-May-11 23:20
Lutosław15-May-11 23:20 
Hello again!

It is another time I encounter this error: "objects added to an IDictionary must have a Key attribute or some other type of key associated with them.". I searched google to find out what is going on, but in every case the reason was that somebdy didn't set either Key or TargetType.

I my case, I set the TargetType, but it doesn't work. In my previous post the problem was that I was using a UserControl. Now I try to set a template of a ToggleButton which is not a UserControl. WTH is going on? Confused | :confused:
XML
<ControlTemplate TargetType="ToggleButton">
    <ControlTemplate.Triggers>
        <DataTrigger Binding="{TemplateBinding IsChecked}" Value="True">
            <Setter Property="Opacity" Value="1" />
        </DataTrigger>
        <DataTrigger Binding="{TemplateBinding IsMouseOver}" Value="True">
            <Setter Property="Opacity" Value="0.7" />
        </DataTrigger>
    </ControlTemplate.Triggers>
</ControlTemplate>

(...)

<ToggleButton Grid.Row="3" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" BorderThickness="0" BorderBrush="Transparent" Opacity="0.3">
    <Image Source="{StaticResource CheckedImage}" Height="16" />
</ToggleButton>

The error started to appear since I changed something. I had tried to revert my recent changes but I couln't work out what is wrong D'Oh! | :doh:
EDIT: I've tried to set x:Key and reference Template={StRes key} and got exception:
{"'Set property 'System.Windows.DataTrigger.Binding' threw an exception.' Line number '59' and line position '18'."}

Inner:
{"Unable to cast object of type 'System.Windows.TemplateBindingExpression' to type 'System.Windows.Data.BindingBase'."}
Inner:null
Edit2: IsChecked IS a dep property
Any ideas?
Greetings - Jacek
modified on Monday, May 16, 2011 5:46 AM

NewsRe: objects added to an IDictionary must have a Key attribute Pin
Lutosław16-May-11 0:05
Lutosław16-May-11 0:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.