xaml

Preventing deformation in XAML Grid's background when resizing

I am writing a brush in XAML that I can use to paint the background of a Grid to create a banner. It looks like this: I want the brush to "stretch" with the Grid when the Window resizes, but I do not want the center angles to deform. I only need to be able to draw the shapes in the background of a Grid. How can I avoid the deformat...

How to get a UserControl to stretch to fill the alloted space?

In a 630 x 400 Window, I'm loading there XAML elements: menu at top dynamic user control footer at the bottom The problem is that when I set the background of the UserControl, the color only goes down as far as the content. I want the background of the UserControl to cover the whole UserControl of course. I've tried: VerticalConte...

Passing parameters to a template

Hi, Say I have defined a button with rounded corners. <Style x:Key="RoundButton" TargetType="Button"> <!-- bla bla --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border CornerRadius="0,5,5,0" /> <!-- bla bla --> </ControlTemplate> </Setter.Value> </Setter> </Style> I it pos...

Showing a dynamic size list in XAML (readonly)

Hi, I want to show a list of "properties" in my application. A property is simply a name/value pair. The number of properties is dynamic. The best way to do this? The only thing I can come up with is creating a ListView with an ItemTemplate. But then the items are selectable, and that's not what I want. If I make the list read-only, it...

Siverlight Grid XAML script issue

Hello everyone, Here is my Siverlight Grid script, I want Media Element mediaPlayer to occupy left half of the whole Grid space, and want Media Element cameraPlayer to occupy right half of the whole Grid space. But my following code does not work quite well (I have set related Grid column/row value), two Media Elements play overlap. An...

Using XAML + designer to edit Plain Old CLR Objects?

I want to write a POCO in XAML, and use a DataTemplate to display that object in the GUI at runtime. So far, so good; I know how to do all that. Since I'll already have a DataTemplate that can transform my POCO into a WPF visual tree, is there any way to get the Visual Studio designer to play along, and have the Design View show me the ...

How do I properly add a prefix (or suffix) to databinding in XAML?

How do I databind a single TextBlock to say "Hi, Jeremiah"? <TextBlock Text="Hi, {Binding Name, Mode=OneWay}"/> Looking for an elegant solution. What is out there? I'm trying to stay away from writing a converter for each prefix/suffix combination. ...

Synchronizing WPF control widths in a WrapPanel

I have this case <WrapPanel> <CheckBox>Really long name</CheckBox> <CheckBox>Short</CheckBox> <CheckBox>Longer again</CheckBox> <CheckBox>Foo</CheckBox> <Slider MinWidth="200" /> </WrapPanel> I want all the CheckBoxes inside the WrapPanel to be the same width. Adding the following almost accomplishes the desired e...

How can I define and use a variable in XAML to define a color?

I have a number of elements in my XAML which define Foreground="#555" to be the color of faded text in a readonly textbox. <TextBlock Text="{Binding SingularModelClassFileTitle}" Margin="0 10 0 0"/> <TextBox Text="{Binding SingularModelClassFileName}" HorizontalAlignment="Left" IsReadOnly="True" Foreground="#...

What is the correct color notation in XAML: #555 or #555555?

Doing CSS throughout the last couple years, I eventually learned that the standard way to represent a gray color shade (or any color which repeated its first three characters) was to use only three characters instead of six, I assume for terseness: #555 instead of #555555 #eee instead of #eeeeee In XAML, however, I often see the oppo...

Serialize an image in XAML using XamlWriter

I'm using XamlWriter to serialize a group of WPF objects. One of these objects is an Image control whose Source is set to a file on disk. When the XamlWriter serializes the objects, it sets the source image to an Uri that points to the file on the filesystem. Is there a way to include that data in the Xaml so that instead of referencin...

Prevent a readonly textbox from being grayed out in Silverlight

In Silverlight, How do I make a TextBox with IsReadOnly="True" not become grayed out. The gray effect looks horrible with my app and I would like to disable it, or change its appearance/color. ...

Odd Loaded behavior in markup versus code

I'm currently very confused by the differing behavior regarding the FrameworkElement.Loaded event. I've put together a small example application that demonstrates this. Xaml: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/20...

How do I create a dashed border with rounded corners in WPF?

The Rectangle element has StrokeDashArray which allows it to be drawn with dashes, but it doesn't support rounded corners. The Border control supports nice thick lines with rounded corners, but will only draw solid lines. What's the best way to achieve a dashed border with rounded corners, with any control? ...

How to animate a resource in XAML?

In an XAML document, I have a gradient brush as a resource and a bunch of shapes that use this resource. I would like to animate the brush using a storyboard, but I don't know how to set the brush in resources as the target of storyboard. Simply using its name does not work, {StaticResource name} does not work either. Is it even possible...

problems after copying XAML controls from WPF Application to class library

In the process of refactoring some code I encountered several build errors like these: Library project file cannot specify ApplicationDefinition element. The project file contains a property value that is not valid. How can these errors be resolved? ...

Tile Images in Silverlight Controls

Warning: Silverlight/WPF n00b I'm just starting looking at Silverlight. It just became apparent that brushes are not tile-able in Silverlight, unlike WPF. I'd like to tile a graphic in a grid control. The image is basically tile able per grid cell. Can a use multiple brushes per control, or should I use lots of image controls, or? Than...

WPF - Binding and RenderTransform

Hello, I would like to bind a scaleTransform to a converter passing the ActualWidth or ActualHeight. Here what I want to do : <Canvas x:Name="Canevas"> <Canvas.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UIElemen...

How do I autosize a silverlight 3 usercontrol based on its contents?

Using Silverlight 3 I am trying to recreate the class object visualization as seen in Visual Studio's class diagram. However, my objects will represent database objects rather than class definitions. I have been partially successful as seen in the following two images. Both of these have been created with fixed sizes, and so they ...

How can I hide the space to the left of menu items in XAML menus?

Is there a way that I can suppress the space to the left of a MenuItem's text? Something like LeftAreaVisible="Collapsed" (pseudo-code) below: <Menu DockPanel.Dock="Top"> <MenuItem LeftAreaVisible="Collapsed" Header="MVVM" ItemsSource="{Binding MvvmMenuPageItemViewModels}" ItemTemplate="{StaticResou...