3

I'm having troubles using Blend with my visual studio solution.

In Runtime, and compile time everything is just fine.

As you can see in the picture, Blend urges me to Build the project, but it does not change the situation, even after a successful build, rebuild, clean & build, it is still the same, the UI is blocked from the designer

Any ideas?

alt text

EDIT: Typos fixed, problem persists.

Converter code:

namespace BlendTest
{
    public class TestConvert : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }  
}      



<Window
  x:Class="XP2Win7.UserInterface.ImageViewer.MainView.MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:BlendTest"
  WindowState="Maximized"
  WindowStartupLocation="CenterScreen"
  Background="Transparent"
  Title="Test">
    <Window.Resources>
        <local:TestConvert x:Key="TestConvert"/>
    </Window.Resources>
    <Grid x:Name="RootLayout" >
        <TextBlock Text="Hello" Visibility="{Binding IsMargol, Converter={StaticResource TestConvert}}" FontSize="48" FontWeight="Bold" />
    </Grid>
</Window>

Thanks Ariel

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
ArielBH
  • 1,991
  • 3
  • 22
  • 38
  • Can you add the XAML declarations, both of your namespace, adn of any controls using this converter? – Reed Copsey Sep 01 '09 at 18:50
  • Sure. Done. Removed the other converter so it will be easier to follow. the problem still persist regarding the TestConvert – ArielBH Sep 01 '09 at 20:10
  • I edited my answer with my best guess at this point. – Reed Copsey Sep 01 '09 at 20:28
  • According to what you've provided everything should work fine (and it does in my test solution). Can you create a test project with exactly the same window as you have in your question, and confirm that it does crash MS Expression Blend 3 designer? Can you share error screen? Current screenshoot doesn't look like as it was taken from this code... Maybe the most important part left out of our sight? – Anvaka Sep 01 '09 at 20:45
  • @anvaka, I know, I've been wasting tons of my time on that thing. The reason I've TestConvert on the first place is that I've a started from a working piece of code and tried to integrate it into my existing large solution(31 projects) and see when it start failing. – ArielBH Sep 01 '09 at 21:03
  • I had this same issue with Visual Studio 2010. I added an implementation for the ConvertBack routine (instead of throwing NotImplementedException) and restarted the IDE and finally the errors magically went away. I did not have to use a separate class library for my custom controls or converters. – SliverNinja - MSFT Apr 07 '11 at 13:49

4 Answers4

0

It looks like you have typos in your XAML:

Alubm instead of Album and BlentTest instead of BlendTest

I'm guessing the errors are actually true compiler errors, and correcting the two typos above will most likely "fix" the designer.


Edit:

The most likely candidate that I see is that your converter is in a separate project from your XAML file (but in the same solution). If that's the case, make sure to specify the assembly in the XAML declaration, and make sure the other project (with BlendTest) is referenced correctly. ie:

xmlns:local="clr-namespace:BlendTest;assembly:BlendTest"

If your referring to a type (with namespace) defined in a different project, the assembly reference needs to exist, as well.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373
  • No, the typos are consistent enough for it to compile :) – ArielBH Sep 01 '09 at 17:44
  • It's not successfully compiling. It's showing you actual compile errors in your XAML file at the bottom of the window. – Reed Copsey Sep 01 '09 at 17:45
  • This is part of the problem. Visual Stdio compile it without problems, Blend compile it without problems (the output window indicate "The build has successfully completed.") – ArielBH Sep 01 '09 at 17:47
  • Are your converters (that are being referenced there) created with public visibility? If they're private, it may cause issues in the designer. – Reed Copsey Sep 01 '09 at 18:01
  • 1
    Can you edit your question to include the XAML, both the namespace section, and the lines that are erroring? Without that, there's no way to debug this further. – Reed Copsey Sep 01 '09 at 18:08
  • No, it's on the same project. – ArielBH Sep 01 '09 at 20:41
0

Well, while the cause of the problem is still unknown to me.

The solution to the mess was as followed:

  1. I've created a new Code Library project, and moved there all my controls and converters.

  2. I used the XmlnsDefinition attribute to decorate the assembly so each was corresponding to the same namespace.

  3. fixing all the references.

and Voilà.

Ariel

ArielBH
  • 1,991
  • 3
  • 22
  • 38
0

What worked for me?

Changing the build output path from bin/x86/Debug to bin/Debug worked for me. But still did not make any sense since my Platform Target was set 'x86'. So I decided to dwell more to the issue and found out that Platform selection in the dropdown 'x86' did not reflect the 'Value' set in the project configuration file.

I unloaded the Project in VS, opened .csproj file in the editor to see what the value is for 'Platform'. To my surprise it is set to 'Any CPU' while the dropdown under the build options showed 'x86'. All I did was to manually edit the .csproj file to read 'x86'.

Here are steps to resolve:

  • Right click on VS project
  • Unload
  • Right Click and edit .csproj file
  • Make sure 'Platform' is set to the correct one
slm
  • 15,396
  • 12
  • 109
  • 124
udayr
  • 63
  • 11
0

This answer fixed it for me: I reset the 'Platform Target' to 'Any CPU'.

Community
  • 1
  • 1
DefenestrationDay
  • 3,712
  • 2
  • 33
  • 61