Application is not supported in a Windows Presentation Foundation (WPF) project
Had same issue in VS. I closed and restarted VS and no longer got the error.
Had same issue in VS. I closed and restarted VS and no longer got the error.
When you set the BuildAction to Resource it goes as embedded resource in an assembly. Or you can set BuildAction to Content then it will bundled into the resulting .xap file. You can use any one of these BuildActions. By setting BuildAction to Content you can access Image like: “/Resources/Images/darkaurora.png” (must begin with slash). And … Read more
Set the ItemsPanel to a Canvas and bind the containers instead of the TextBlock in the DataTemplate <ItemsControl ItemsSource=”{Binding Path=ItemsToShowInCanvas}”> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemContainerStyle> <Style TargetType=”ContentPresenter”> <Setter Property=”Canvas.Left” Value=”{Binding Left}”/> <Setter Property=”Canvas.Top” Value=”{Binding Top}”/> </Style> </ItemsControl.ItemContainerStyle> <ItemsControl.ItemTemplate> <DataTemplate> <TextBlock Text=”{Binding Path=Text}” /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>
Typically, you “draw” in WPF in a completely different manner. In Windows Forms/GDI, the graphics API is an immediate mode graphics API. Each time the window is refreshed/invalidated, you explicitly draw the contents using Graphics. In WPF, however, things work differently. You rarely ever directly draw – instead, it’s a retained mode graphics API. You … Read more
To freeze a Freezable object declared in markup, you use the Freeze attribute defined in XML namespace http://schemas.microsoft.com/winfx/2006/xaml/presentation/options. In the following example, a SolidColorBrush is declared as a page resource and frozen. It is then used to set the background of a button. <Page xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:po=”http://schemas.microsoft.com/winfx/2006/xaml/presentation/options” xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ mc:Ignorable=”po”> <Page.Resources> <!– This brush is frozen … Read more
The delimiter for specifying multiple actions is a semicolon ; <Button Content=”Let’s Talk” cal:Message.Attach=”[Event MouseEnter] = [Action Talk(‘Hello’, Name.Text)]; [Event MouseLeave] = [Action Talk(‘Goodbye’, Name.Text)]” />
Update (for UWP) In UWP Apps you don’t need this and can use the TextBlock property MaxLines (see MSDN) Original Answer: If you have a specific LineHeight you can calculate the maximum height for the TextBlock. Example: TextBlock with maximum 3 lines <TextBlock Width=”300″ TextWrapping=”Wrap” TextTrimming=”WordEllipsis” FontSize=”24″ LineStackingStrategy=”BlockLineHeight” LineHeight=”28″ MaxHeight=”84″>YOUR TEXT</TextBlock> This is all that … Read more
What Alex says is the way to go. But I think its a little confusing to understand what he is saying. Assuming you have your project open in Visual Studio, open another Visual Studio instance and select Debug->Attach To Process. In the dialog which opens select XDesProc.exe (which is the XAML UI Designer) for VS2012 … Read more
@lhildebrandt’s answer is generally right, but in my case this solution produces errors that totally disable displaying the view in designer. Specifying <d:Style.DataContext> inside <Style> tag helped me. <Style> <d:Style.DataContext> <x:Type Type=”local:MyTreeItem” /> </d:Style.DataContext> <!–usual setters, triggers, etc.–> </Style> In this way d:DataContext can also be specified for controls, and we can provide it interfaces, … Read more
You can use Text=”{Binding}”. The ToString() method is invoked implicitly.