xaml

How to Read some of the properties of the ItemSource when Laying out the Children?

Assume that I have the ItemSource bound and i am getting the data. Now what I want is this. The ItemSource will contain Data that tells where each button should be. For Example: The first Button could be at Left:200,Top:0, the Second could be Left:50 Top:20. </ItemsControl.Resources> <ItemsControl.ItemsPanel> <I...

Why is generated XAML spitting out namespaces that are not asked for?

I have a very simple XAML form, that has one namespace definition. For some reason, when Visual Studio processes that XAML file in to it's component .g.cs, it's sticking a bunch of namespace definitions at the top that I have not asked for in the XAML, or the code behind, and they are namespaces that no longer exist in my project. Thus t...

How to design parts of the application in XAML and how to reusing it then?

I'm working on a main window in my application and I would like to design parts of my window separately in Visual Studio designer. Main window Game desk (actually more of them and therefore it would be nice to design the game desk, mark it as a resource and then just via simple code (something like creating a new object and setting ...

Is using value converters to generate GUI-friendly strings a misuse of value converters?

Currently, I use value converters to generate user-friendly strings for the GUI. As an example, I have a window that displays the number of available entities in the status bar. The Viewmodel simply has an int dependency property that the calling code can set, and then on the binding for the textbox that displays the number of entities...

WPF: TextBox expanding with surrounding Grid but not with text

I have a problem with a TextBox in an application... A window has a Grid with two columns. The left column contains a control with a constant width but with a height that adapts. The right column contains a TextBox that takes up all remaining space in the Grid (and thereby in the Window). The Grid is given a minimal width and height a...

How to Populate Multiple Collection Properties in a Xaml Element

I am creating a class that inherits from System.Windows.Documents.Paragraph and adds a new collection property. Here is a very simplified representation of that class: public class ExtendedParagraph : Paragraph { public Dictionary<string, string> Attributes { get; set; } } I need to create and populate an instance of the above cla...

How can I assign Custom Style to GridViewColumn?

In my wpf application I am using custom styles for most of the controls and want to do same with ListView. This style is in a separate resource project, which has customcontrols written by overriding the existing wpf controls and applying a custom styling to them. This project is shared among other projects which are using the controls d...

Binding a value in a Storyboard

Hi stackoverflow, I'm looking for some kind of workaround for binding a Value in a Storyboard. Thing is, that I need to bind the value in a tag, like this: <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="testelement" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"> ...

Resize Clipping Path on window resize in WPF

Hello, I was wondering how to resize a Clipping path dynamically when resizing the window. Right now I'm taking a rectangle in Expression Blend that resizes with the window. Applying this rectangle to a circle as a clipping path makes the rectangle fixed, and it won't resize anymore. I've seen different ways of making clipping paths in...

WPF how to fill combobox in data grid

public class DA_ActivityType { public int Id { get; set; } public string Name { get; set; } } public static List GetActivitytypes() { DataContext dbo = new DataContext(); IEnumerable activityTypes = from actType in dbo.ActivityTypes ...

C# WPF XAML binding to DataTable

I have the following tables: Company {CompanyID, CompanyName} Deal {CompanyID, Value} And I have a listbox: <ListBox Name="Deals" Height="100" Width="420" Margin="0,20,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Visibility="Visible" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}" Sel...

What's a good xmlns alias for the WpfApplication1.Properties namespace?

I know I can call it whatever, but just like there is a convention for project's namespace (xmlns:local), is there a good name I could call the Properties namespace so that any coder could walk up to my code and instantly recognize it? Currently, I use xmlns:Properties, but that's too long in my opinion. ...

Wpf calendar change header background

Hi! How to change header background of a calendar control? I need only top, not all area. Thanks a lot!! ...

Is there a way to chain multiple value converters in XAML?

I've got a situation in which I need to show an integer value, bound to a property on my data context, after putting it through two separate conversions: Reverse the value within a range (e.g. range is 1 to 100; value in datacontext is 90; user sees value of 10) convert the number to a string I realise I could do both steps by creati...

XAML to HTML Conversion - WPF RichTextBox

I have the problem where i have a WPF RichTextBox, and i'm extracting its XAML code and saving it to a txt file. When i copy paste the XAML code generated to a XAMLtoHTML converter like this http://blogs.msdn.com/wpfsdk/archive/2006/05/25/606317.aspx , some error must be occuring as i'm always getting a blank result! If i write test in ...

How to add handler in dynamic datatemplate

I am successfully declaring a data template in a code behind as follows: private static DataTemplate CreateTemplate(string sortMemberPath, HorizontalAlignment horzAlignment) { const string xamlFormat = "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" >" ...

WPF Constrain the resize of a canvas' child object to the dimensions of the canvas

Given the following XAML: <Window x:Class="AdornerTesting.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="500" Width="500" Loaded="Window_Loaded"> <Grid Name="grid"> <Canvas Name="canvas" ...

WPF Custom Control with Image problem

Hi all, I am quite new to WPF/XAML and I am currently facing a problem. I have a solution with two projects in it, the first project is a Custom Control Library with a custom Window form control inside. The second project is a WPF application using my custom window form. All work fine except for the form Icon. In the WPF application p...

How do I create a clicked state in a Silverlight button?

How do I create a clicked state in visual state manager for a control that is based on a button control? I tried using a pressed state but once the mouse button is released it reverts back to the original color. I would like to change the color of the button when it is clicked on. I am not looking for a solution in the click event handle...

WPF listbox select item on mouse over

I'm trying to make a style for a listbox which will set the selected item to an item when the item has the mouse on it. Any hints? ...