xaml

Assembly Reference in Loose XAML

I have scenario where my loose xaml file can contain the custom control from another assembly. How do i make a reference to that assembly. My Loose XAML and assembly are at the same path. I know the embedded xaml or xaml with in a project, the reference is added like this: xmlns:WpfToolKit="http://schemas.microsoft.com/wpf/2008/toolkit"...

What should you use IValueConverter for?

What are the recommended uses of IValueConverter? I've used it for things like converting a boolean property to a Visibility property but I'm wondering how far you should take it? Is it supposed to be only used to change representations of common types to UI specific types (bool to Visibility for example). E.g., if I have a property i...

Separating designer from xaml window for wpf in vs2010

Hi, i don´t find a button to separate the designer window from the xaml window for wpf in Visual Studio 2010. I´ve got 3 screens and i want a full screen xaml and a full screen designer window. Any suggestions? Btw searching the web for "xaml, designer, vs2010, split" wont work ;) Thanks. ...

Binding to FontWeight in Silverlight 4 using a value converter

I want to compare two versions of various properties and bold one of them if it is not equal to the other. Since SL4 doesn't support MultiBinding I am binding the FontWeight to "." so that the entire data context is passed to the converter. I then use the converter parameter to specify which fields to compare within the converter. So f...

XAML loading error using contentProperty

Hi to all, I am reading up more on XAML and I have created an XML file and want to load it. It all works but when I use the ContentProperty attribute and more importantly I remove the Company.Employees tags from the XML file, I get the error "cannot add to Company" when loading the xml file. The code is : <?xml version="1.0" encoding=...

Global static resources in a WPF class library?

In a WPF application, you can put your global static resources in app.xaml .. like <Application.Resources> <!--Global View Model Locator--> <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" /> </Application.Resources> That was from MVVM Light ;). Now, if your project is a wpf ...

Databinding Button Content to a static resource fails

I am trying to design a set of icons in a Silverlight 4 User Control's ressources, and then display these on a button. I have <UserControl.Resources> <Rectangle x:Key="Icon1" Fill="Black" Width="10" Height="10" /> </UserControl.Resources> and <Button x:Name="Button1" Width="50" Height="50" ...

DynamicActivity - How to invoke a workflow that stored in Database?

Hi, This is proof of concept project - The goal is to create an application that receive some system wide events and based on some business rules invokes a specific workflow. The workflows are created separately and the xaml source is stored in a database. Following is the code that used to invoke the workflow: public void RaiseEvent...

Add EventToCommand to each Row in xaml

Is there a way to add a DoubleClickEvent to each Row in xaml rather than using the event of the datagridcontrol? Something like this (this code does not work): <UserControl xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;a...

Referencing a value defined in xaml

Hi all. I have several controls which I would like to all share the same width, specified at compile time. So either they all use a width of 10, all use a width of 20, etc. What is the proper way to define this value once, and use it like a variable from there on out? "Gives you the idea" pseudocode: double my_width = 10; <Label wid...

Update item in collection & display in WPF

I have the following scenario: User enters values in a form and submits The submit methods calls a service passing the form related object as a parameter The object is persisted in the db The object gets assigned a new ID and gets returned to the calling method The object is add to a collection in the submit method I have an expander...

Can an IGrouping enumeration be bound in XAML? And if so, what would the binding syntax look like?

I have a list of Customer objects, which I've grouped on Country. var query = from c in ctx.Customers group c by c.Country ... query is now an enumeration of groups (IQueryable<IGrouping<string, Customer>>), where each item of thie enumeration defines a group (IGrouping<string, Customer>). I understand that IGrouping is: the...

Binding List to Listbox

My listbox is not displaying the items. The items are in a List<string>. Here is the xaml: <DockPanel Margin="10,10,10,10"> <DockPanel.Resources> <local:MyErrors x:Key="myErrors"/> </DockPanel.Resources> <ListBox DockPanel.Dock="Top" ItemsSource="{StaticResource myErrors}" Height="300" Width="250" Margin="0,5,0,10" ...

How do I add .CS functionality to XAML classes built in Expression Design for a Silverlight APP?

How do I add .CS functionality to XAML classes built in Expression Design? I have a Silverlight project handed to me by designers that does not seem to have much functionalty to it yet. One of the first things I have noticed is that there does not seem to be any corresponding .cs files that match up with what appears to be children of ...

Binding value to checkbox

I have class Student { public List<Degree> Degrees {get;set;} } class Degree { public Subject Subject{get;set;} public int Value {get;set;} } class Subject { English =0, Germany = 1, Biology=2 } And I have a Treeview <HierarchicalDataTemplate DataType="{x:Type MyService:Student}" > <TextBlock TextAlignment="Justify" VerticalAl...

Accessing ItemsSource source item

I'm creating an error list control similar to the in Visual Studio. Each error is represented by a class with three values: type (enum: Error/Warning/Message), text (string) and time (DateTime). The class has also two more read only getters: TimeString (returns time as HH:MM) and Icon (returns icon path based on type). I have an ItemsCo...

Exception not showing

I have : public class Person : INotifyPropertyChanged { private string _name; public int Age { get; set; } public string Name { get { return _name; } set { if (!String.IsNullOrEmpty(_name)) { if (String.IsNullOrE...

WPF MenuItem : Mix databound items and static content

Hi there, I'd like to build an MRU menu that has the following structure: File +=>Recent Files +=> Doc1.txt +=> Doc2.txt -separator- +=> Clear entries This being MVVM, my mru list is databound to the View Model. Because I want to add the separator, and I don't fancy inserting the separator and the clear entry action in th...

WPF Datagrid template removes ability to resize columns

How come whenever I override the default template for a DataGridColumnHeader it can no longer be resized by the user even though CanUserResizeColumns is set to true for the datagrid? Is there something that I need to add to the template to restore this functionality? Here's my template xaml: <Style x:Key="ColumnHeaderStyle" TargetType=...

Would it make sense to use XAML for configuration scenarios?

One simple way to add some configuration is to define a configuration section which is not much more than some object that can be (de)serialized based on the XmlSerializer classes. Now, XAML is at its heart more or less a hierarchy of objects but provides things like naming of elements, binding, etc. Has anyone ever used XAML outside i...