Question

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

Was it helpful?

Solution 2

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

OTHER TIPS

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.

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

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top