xaml

What is the issue with UserControls in XAML / WPF?

I have had major problems with getting UserControls to work in XAML - I have spent hours trying to figure out all the problems but have got nowhere and cannot find where I am going wrong. The main problem I am having is when I create a UserControl for example a simple one which shows an object different colours - I have successfully crea...

How to allow the user to add annotations to UI controls in WPF?

WPF document viewing controls that support annotations include FlowDocumentReader and FlowDocumentScrollViewer, as well as controls derived from DocumentViewerBase such as DocumentViewer and FlowDocumentPageViewer. The in-built Annotations support for Document based controls is awesome in WPF I was wondering how would it be possible to...

What does "{x:Static}" mean in XAML?

What does "{x:Static}" mean in XAML? Code sample: <SolidColorBrush Color="{x:Static SystemColors.ControlColor}" /> ...

How do I include a custom row at the end of a DataGrid in Silverlight?

I have a DataGrid in my Silverlight application and it works nicely, adding a row or removing a row as I manipulate the ItemsSource collection. However, I want there to be an additional row, or control that always appears after the last data row. I can get the additional control to appear after the last row using a ControlTemplate and s...

Wpf -how do i listen to window resizing?

I've got a windows forms map in a WindowsFormsHost, and I need it to resize with the window. I'm just not sure what event to listen to, to do this. I need the map to only resize once the mouse is up, otherwise it lags out, and tries drawing itself a million times when you resize a window really slowly. ...

How do I set TargetNullValue to a date?

I'm using the WPF toolkit's Calendar control to allow users to select a date. If the date is not yet selected then the property the SelectedDate is bound to is Null. This makes the Calendar default you January 1, 0 AD. I'd like to do something like SelectedDate="{Binding UserPickedDate, TargetNullValue=Today, Mode=TwoWay}" But both "T...

In XAML style, how to change solid background to gradient?

I've got a MainResources.xaml file in which I have a style that defines how each of my windows in my application look: <Style x:Key="MainBorderStyle" TargetType="{x:Type Border}"> <Setter Property="Background" Value="WhiteSmoke" /> <Setter Property="BorderBrush" Value="LightGray" /> <Setter Property="BorderThickness" Value...

Why does XAML Margin not follow CSS norm?

In CSS the margin order is: top right bottom left In XAML the margin order is: left top right bottom Is there a reason why the WPF team didn't align this to the CSS norm? ...

Why are XAML resources unlike CSS styles?

In Expression Blend you can create a font-size of say 18 and then create a "font-size resource". Coming at this from HTML/CSS, I cannot think of when I would want to make a style for a "font-size" and one for a "font-style" and one for a "font-weight". Instead I want to make a font called "CompanyHeader" and have 10 different attributes...

Is it possible to access a Silverlight DataGrid Column by name rather than by column index ?

Does anyone know if it's possible to access a DataGrid column by using it's x:name (as defined in the xaml) from within the code behind ? I know I can use the following code : myDataGridList.Columns[0].Header = "Some Data"; ..but I would prefer to use something like this if possible: myDataGridList.Columns["ColumnName"].Header = "So...

How to format string in XAML Setter Value?

I have learned how to format strings in the content attribute of a label like this: <Label Content="{Binding ElementName=theSlider, Path=Value}" ContentStringFormat="The font size is {0}."/> I want to do the same thing in a Setter but "ValueStringFormat" doesn't exist, what is the correct syntax to do what I want to accomplish her...

Setting Properties of Control Templates in XAML

I've created a button control template where I want to change the glow color of the button on the xaml level. Here is what I mean. <Button x:Name="btnClose" Template="{DynamicResource GlassButton}" Width="32" Height="32" GlowStartColor="Red" GlowEndColor="DarkRed">Button1</Button> The GlowStartColor and GlowEndColor are the propertie...

WPF Linq to SQL applications Some Best practices using binding and master/detail views

Hi, Well i feel im missing something here because im having problems i bet a bunch of people ran into before and i cant find any solutions to this simple scenario. Application Technology: WPF, 3.5(sp1) framework, LINQ to SQL, o/r designer CRUD, Visual studio 2008, C#. Apllication Layout: Main layout conatins a panel to the left holdi...

How to make a simple hyperlink in XAML?

All I want to do is make a little hyperlink in XAML. I've tried everything. I give up. What is the syntax for this? <StackPanel Width="70" HorizontalAlignment="Center"> <Hyperlink Click="buttonClose_Click" Cursor="Hand" Foreground="#555" Width="31" Margin="0 0 0 15" HorizontalAlignment="Right">Close</Hyperlink...

How do I make a RadioButton's Bullet align top?

I have a multiline radio button and I want the bullet to be to the left of the content (as default) aligned to the top of the radio button control. What's the easiest way to do this in XAML? ...

Is my ItemsSource syntax ok?

I have the following XAML. Let's say FruitList is a collection of Fruits, each of which has a collection of FruitSeeds. Is there a syntax to bind cbxFruitSeeds to a collection of FruitSeeds, depending on which Fruit is selected in cbxFruits? <GridView> <GridViewColumn Header="Fruits"> <GridViewColumn.CellTemplate> ...

WPF Triggers

Hi, I'm trying to set a trigger to display a block of text when the value i get for the cell is a certain type. I have successfully managed to display an image in the same situation, but in this circumstance i don't want an image, but some text. Have commented out lines in order to test.try to make it work. The commented out code work...

What is the XAML syntax for setting a Trigger on a Label?

I have a DataTemplate that is displaying objects with three fields, e.g.: Name = "Font Color" Value = "Orange" Editable = "True" but I want to display them as e.g.: Font Color: Orange Editable But I'm having trouble finding the syntax to use Triggers here in order to e.g. display "Editable" when the field Editable="True" Does anyon...

JPG as a Window Icon using XAML?

Is it possible to use a JPG file as a Window Icon using strictly XAML? I've found examples where you can use a BitmapFrame within C# to generate an ImageSource on the fly (which is then assignable to the Icon property), but I'd love to do something like: <Window.Icon> <SomeXAMLThatLetsMeUseJpg Source="MyJpg.jpg" /> </Window.Icon> ...

WPF - App.xaml file does not get parsed if my app does not set a StartupUri ??

Background: I'm creating a WPF app using MVVM, and using a DI container to build my ViewModels My App.xaml looks like this: <Application x:Class="WpfApp.App" ...xmlns etc... StartupUri="MainWindow.xaml"> <Application.Resources> <app:ServiceLocator x:Key="serviceLocator" /> </Application.Resources> </Application>...