xaml

Why do you need to have brackets around attribute values for XAML animations?

This has been bugging me for a long time now and I can't seem to find a good explanation for it. What is the purpose of the brackets in this markup? Is it a XAML shortcut for casting? Why does it only seem to be used for animations? Storyboard.TargetProperty="(TextBlock.RenderTransform).(RotateTransform.Angle)" If anyone has an ...

How can I set this Image Source in XAML?

Currently, I have this in MainWindow.xaml: <Image Name="LogoImage" /> And this in MainWindow.xaml.cs: public ImageSource LogoImageSource { get; set; } .... var rm = new ResourceManager("Project.Properties.Resources", GetType().Assembly); var logoBmp = (Bitmap) rm.GetObject("CompanyLogo"); if (logoBmp != null) { var hBitmap = l...

Add dynamically loaded WindowsForms control to a WPF WindowsFormsHost

I have a WPF project where I load a WindowsForsm assembly (dll file) dynamically like this: Assembly currentAssembly = Assembly.LoadFile(System.IO.Directory.GetCurrentDirectory() + @"\" + fileName); System.Windows.Forms.Control currentControl = (System.Windows.Forms.Control)currentAssembly.CreateInstance(feat...

ItemsControl with ItemSource set to ObservableCollection of UserControls fails to render in visual tree

inside TestEntryView.xaml.cs public partial class TestEntryView : UserControl { public ObservableCollection<TestFieldView> Fields {get;set;} ... } where TestFieldView is a UserControl. <UserControl x:Class="STS2Editor.View.TestEntryView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns...

WPF UserControl cannot find XAML resource in referencing project

Hi In my WPF project i keep a user control in a separate library project. The user control accesses resources in a separate XAML file, like this: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Resources/ViewResources.xaml" /> </ResourceDi...

WTF WPF TabControl?

I believe this to be a bug in WPF (v4.0 if it matters), but it is late, and maybe I'm missing something. I am binding to a fake example for illustrative purposes: <x:Array x:Key="SampleItems" Type="sys:String"> <sys:String>Foo</sys:String> <sys:String>Bar</sys:String> <sys:String>Baz</sys:String> </x:Arr...

Stretch the wpf tab control content

I am trying to stretch the wpf tab control content for fit the screen when it resizes even if the tab item is empty. There doesnt seem to be a stretch property? ...

WPF enumeration value as ObjectDataProvider's method parameter

Hi ! I want to pass for as a parameter for the GetValues method from MyItemSourceProvider a concrete value of MyEnum. How to write it please? <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type local:MyItemSourceProvider}"> <ObjectDataProvider.MethodParameters> <!-- ENUM value (e.g. MyEnum.Record1) --> ...

Error 'TF215097:...Cannot create unknown type for...' custom CodeActivity

Hi all, I'm trying to create a CustomActivity to run after each successful build. I've followed the exact steps of several tutorials http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2010/03/08/lessons-learnt-building-a-custom-activity-to-run-typemock-isolator-in-vs2010-team-build.aspx http://www.ewaldhofman.nl/post/2010/04/29/Cu...

Why is XamlReader.Load unable to recognize my attached property in Silverlight 4?

I'm trying to figure out how to programmatically apply a theme at runtime in our Silverlight 4 application. I figured this should be as simple as loading a resource dictionary from XAML and merging it with the application's merged dictionaries. Here's my code so far: var themeUri = new Uri( "OurApp;component/Themes/Classic/Theme.x...

WPF - DataTemplate - Using element binding within an attached property

I'm working on an application that uses a richly formatted ListBox. One of the things I need is to bind multiple pieces of information to a button that lives within the ListBox's DataTemplate. This is an over-simplification of my actual code that I made to help you understand the problem. Here's a chunk of XAML from inside the DataTem...

Call a storyboard declared in xaml from c#

I am trying to call a storyboard declared in xaml from c#. <UserControl.Resources> <Storyboard x:Name="PlayStoryboard" x:Key="PlayAnimation"> ... I dont have access to "PlayStoryboard" from the codebehind file. Any ideas what i am doing wrong? ...

Expression blend convert example from Silverlight into WPF

Hey! I was looking at a cool layout example in particular the V3FluidLayout.xaml found inside this set of examples : http://gallery.expression.microsoft.com/en-us/DynamicLayoutTrans Anyhow - this appears to be a silverlight app - it runs within a browser. I am trying to pull the V3FluidLayout example into a WPF app - and struggling. I ...

XAML and local variable/auto property...

Hi all, I try to set a local property through XAML and a trigger. The idea is to "reproduce" the behaviour that exists in most of settings pages with an "Apply" button at the bottom. As soon as the user modify one the the control/settings in the page, I want to set a local variable ("FilterModified") to "true". I tried this, but somehow,...

Silverlight 4: "Invalid XAML" using Converter in DataTemplate

Hi, maybe you could help me understand why I get an unhandled exception "Invalid XAML" in Visual Studio 2010 designer when trying to do the following on a Page. I have a Converter named DateTimeConverter that converts a date into a German date string. The converter works fine. I've included the namespace and added the following to the ...

Use DataTemplate in WPF with a mocked object.

I have following xaml code: <Window x:Class="MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding MainWindow, Source={StaticResource Locator}}"> <Window.Resources> <DataTemplate DataType="{x:Type vm:...

Center a polygon within a Grid control

Hello, Can anyone tell me how to center a polygon object within a given row/column of a Grid control? The example that I have tried is taken from msdn. <Grid x:Name="LayoutRoot" > <Polygon Points="300,200 400,125 400,275 300,200" Stroke="Purple" StrokeThickness="2" HorizontalAlignment="Center" ...

How can you reference a fully defined control as a resource within WPF?

I am aware I can reference styles & templates from a resource dictionary and I make significant use of them. But what about complete controls? I can declare a fully defined WPF control, like a button, within the app.xaml as a resource. For example, the app.xaml file defining a button would contain this: <Button x:Key="HelpButton" Cont...

MVVM Silverlight Framework Choices

Which Silverlight MVVM Frameworks should I look at - taking into account these areas of functionality. 1) IoC - can I choose my own? I would like to avoid using MEF w/ Attributes. 2) Navigation 3) Callback simplification 4) "IMessageBox" type abstractions 5) Testability 6) Logging Note: mitigating a conversion to full-blown WPF is n...

XAML/Silverlight: Passing a collection (e.g. ListBox.SelectedItems) to a DomainService method

I need to pass a set of values to a DomainService method. Here's what I'd like the service method to look like: IQueryable<Person> GetPeople( Nullable<DateTime> MinDOB, IList<String> Ethnicities ) { return from Person item in ObjectContext.People where item.DOB >= MinDOB && Ethnic...