xaml

WPF Update Control In Place Using XAMLReader

I have an existing item which is a child of a canvas. The item's style is contained in a resource dictionary that contains the various brushes that can be used to color the item. When an instance of the item is created it is given the default coloring. I am currently not able to directly interact with the Fill property as in: item.Fi...

Strict vs handy syntax for some properties' values in XAML.

Hi there. There are a bunch of properties to which you could provide a value in several ways. For example: Style.TargetType: "ns:TypeName" vs "{x:Type ns:TypeName}" Button.Command: "ns:TypeName.StaticPropertyName" vs "{x:Static ns:TypeName.StaticPropertyName}" You name it. The question is: are there any drawbacks which comes along w...

How can I make rectangle strech across entire grid?

Hi, I'm building a small WPF application. For the layout in the application, i use a grid with two columns and two rows. I want to have a background rectangle that fills the entire application, and I want the background rectangle to strech so if a user resizes the window, the rectangle streches and always fills the entire window. So ins...

WPF , Getting verticalstretch working as expected!

I am trying to make the vertical stretch to work as expected i WPF, but for some reason it only takes the space it needs, and not the space available. First, I am using WPF with C#, and Prism. In the Shell.xaml (main xaml for the application) I have a grid with 2 columns and one row. The idea is to have a side panel and a main app are...

XAML Context Menu not closing

I've got a "popup" context menu on a list box, and there are two behaviors that would seem "out-of-the-box" but I am having a tough time getting the XAML ContextMenu to behave the way I would expect... One is that, when I pick a sub-menu (e.g. "One" or "Two"), the initial menu continues to stay open (e.g. "Menu" does not go away once I'...

WPF Expander Border Animation affects all contained controls?

I'm using a WPF Expander to display a number of analog process variables. I want to make the expander's border 'glow' (or flash) when one of these variables enters a 'warning' or 'alarm' state. To achieve this, I'm using some data triggers bound to a couple of boolean properties in my view model ('AnalogWarningActive' and 'AnalogAl...

MVVM Sliverlight - can not assign existing control to a property of collection of custom elements in XAML.

I have a class public class Item { public string A { get; set; } public Control B { get; set; } } I'm using MVVM with Silverlight. I have a custom view that is inherited from a standard view. Custom view has public property public ICollection MyItems { get; set; } which should store items described above. In x...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing? ...

How to reference a generic type in the DataType attribute of a HierarchicalDataTemplate?

I have a class of MyClass<MyObject> and want to set it as the DataType for a HierarchicalDataTemplate. What is the syntax for this in XAML? (I know how to set namespaces, I need just the <HierarchicalDataTemplate DataType="{X:Type ..... syntax ...

WPF How to select node from node-list with binding.

Hello, I want to know if the following in XAML is possible: I have a FlowDocument used for printing. The FlowDocument is bound to a DataSource from which I get the current data. The data is a XML-Document which is also bound to an gui where the Data is inputted. The gui contains some comboboxes with a text-representation of the data-val...

How do I bind a ComboBox to a one column list

I've seen how to bind a ComboBox to a list that has columns like this: ItemsSource="{Binding Path=Entries}" DisplayMemberPath="Name" SelectedValuePath="Name" SelectedValue="{Binding Path=Entry}" but If I got a plain list with lets say countries in an 'ObservableCollection' How do I bind to this? I can't use 'DisplayMemberPath' since...

FlowDocument Force a PageBreak (BreakPageBefore)

hi, I'm using C# to create a FlowDocument and fill it with data within a table. Example: FlowDocument flowDoc = new FlowDocument(); Table table1 = new Table(); flowDoc.Blocks.Add(table1); table1.RowGroups.Add(new TableRowGroup()); table1.RowGroups[0].Rows.Add(new TableRow()); TableRow currentRow = table1.RowGroups[0].Rows[0]; table...

Need help hooking up XML file to WPF DataGrid

Here's what I've done so far: In my App class, I declare a new XmlDataProvider and set the source to a valid XML file (whose Build Action is set to Content/Copy Always). public partial class App : Application { public App() { InitializeComponent(); var services = new XmlDataProvider(); services.Source =...

How to reference base URLs for images in XAML in Silverlight?

I have images scattered throughout my silverlight app, and because of the structure we decided on, all images are brought in from an HTTP URL. Currently, in XAML an image would be declared as follows: <Image Source="http://www.example.com/directory/example.png" /> I would like the base URL for all images referenced stored in a global...

xaml: trigger dialog 'Apply' button state

I want to enable 'Apply' dialog button when content of some textboxes in this dialog changes. Here what I came up with <Window.Resources> <ResourceDictionary> ... <Style x:Key="SettingTextBoxStyle" TargetType="{x:Type TextBox}"> <Style.Triggers> <EventTrigger RoutedEvent="TextBox.TextChan...

convert XAML-Canvas to bitmap

hi there, i need to convert a large amount of icons in xaml format (all just use canvas) to bitmap format. does anybody know about a tool that does that? i only found xamltoys/xaml2emf this works but not correctly - colors are messed up and resolution is very low. thanks! ...

Getting a templated button's command to work

I've used a control template to change the appearance of a button in a trivial way. It now looks different, but does not behave like a button. There are really two problems: The button's command is never executed After clicking on the button, it appears selected (i.e., the ellipse turns into an ugly blue rectangle) Here's the gener...

How to enforce MinWidth & MinHeight in a WPF window where WindowStyle="None"?

I have a WPF application in which the main window's decoration is custom, via WindowStyle="None". I draw my own titlebar and min/max/close buttons. Unfortunately, Windows doesn't enforce my MinWidth and MinHeight properties when the window is resized, thus allowing the window to be resized all the way down to 3x3 (appx - just enough to s...

Wpf Panel Background problem

When i don't set background of my panel i can not get mouse events on that. why this behaviour? I am able to get mouse events on panel by setting Background to Transparent which is null by default. Whats the difference between Background null and Transparent? ...

How to fill an overlapped area when FillRule fails?

Hi, I'm trying to draw a hand-made DB drum alike shape. The problem is that the top ellipse is not completely filled. Sample: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Image Width="126" Height="42" Margin="3" HorizontalAlignm...