Ask a questionAsk a question
 

Answerpossible bug

  • Tuesday, March 25, 2008 8:10 PMrhombus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I encountered a design time error on the EventSetter line below. The thing is, Selected is an event for ListViewItem. Also, the handler gets fired nomally. I haven't reported this yet because I'd prefer to get confirmation first.

     

    <Style TargetType="ListViewItem">

    <EventSetter Event="Selected" Handler="ListViewItem_Selected"/>

    </Style>

     

    Error 18 Value 'Selected' cannot be assigned to property 'Event'. Invalid event name. 

Answers

All Replies

  • Wednesday, March 26, 2008 5:44 PMMark BoulterModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Yes this is a bug. Please use the Connect web site to report it - thanks - mark

     

  • Friday, March 28, 2008 8:59 PMrhombus Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I have reported this as a bug, if anyone here has seen or can confirm this bug, please add verification if you have the time to spare.

     

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=335722

  • Monday, March 31, 2008 6:25 PMMark BoulterModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks for reporting the bug - much appreciated - mark

     

  • Monday, May 05, 2008 7:49 PMSteffen_Sorensen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I experiance something similar. The designer in Visual Studio 2008 Professionel Edition says it has a problem loading when I use EventSetters in a specific way. The error message is "Cannot load XAML file that has EventSetters. Try compiling the XAML". The line number does not match the line where my EventSetter is.

    When I compile the XAML it works fine and the event fires.

     

    Here is the code that makes the designer fail:

     

    Code Snippet

    <Window.Resources>

    <ObjectDataProvider x:Key="dataModel" ObjectType="local:DataModel"/>

    <DataTemplate x:Key="MyTemplate">

    <Grid>

    <Grid.Resources>

    <Style TargetType="{x:Type Button}">

    <EventSetter Event="Click" Handler="mouseclick"/>

    </Style>

    </Grid.Resources>

    <Button Width="100" Height="50" Content="{Binding}" />

    </Grid>

    </DataTemplate>

    </Window.Resources>

    <ListBox ItemsSource="{Binding Source={StaticResource dataModel}, Path=Persons}" ItemTemplate="{StaticResource MyTemplate}"/>

     

     

     

    I have Blend 2 trail installed alongside. Earlier I had Blend 2 beta February release. Both of these have the same problem reading this XAML!


  • Wednesday, July 02, 2008 9:49 AMRainer Engblom Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have a similar problem, 

    <Window.Resources>
    ...

        <Style x:Key="EditableTextBoxStyle" TargetType="{x:Type TextBox}">
            <EventSetter Event="TextChanged" Handler="TextBox_TextChanged"/>      
        </Style>
    ...

    </Window.Resources>

    Rebuild in Blend gives "Cannot load XAML file that has EventSetters. Try compiling the XAML..."

    I'm using the June 2008 preview.

    The code compiles in Visual Studio 2008

    Rainer
  • Monday, September 29, 2008 6:13 PMmatte303 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    This seems to be fixed in Visual Studio 2008 with SP1 installed. The Cider designer handles it fine.  Unfortunately Expression Blend is still broken.   In Blend 1.0 you would get the error message but it would still allow you to design the control, in Blend 2.0 you can no longer design the control at all unless you comment out the EventSetter.  I have posted a followup to an existing thread on the Blend forum offering a demo project to anyone at Microsoft willing to take a look:

    http://social.expression.microsoft.com/Forums/en-US/blend/thread/49c7a0af-0c20-4a10-b82b-0cb4dca3eef6

    If you are interested in getting this bug fixed in Blend, I suggest participating in that thread.
  • Thursday, October 23, 2008 3:46 PMMaseyBoy Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Steffen if you move your Style from the Grid.Resources to the Window.Resources this should fix the designer problem. Well, I had a similiar error and it worked for me!
  • Tuesday, November 03, 2009 7:44 PMsramakrish Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Steffen,

    Could you please let me know whether you were able to fix this? I am gettting the same error.

    Thanks,