Anything is more compact (or otherwise better) than
<x:Array x:Key="titles" Type="System:String">
<System:String>Mr.</System:String>
<System:String>Mrs.</System:String>
<System:String>Ms.</System:String>
</x:Array>
?
...
I created a resource file as 'Style' which sets the fillcolor and border of a rectangle.
In 'code' I create a rectangle which is dynamic in size as it's being set by another rectangle size.
What I want is to create the code-based rectangle and have its style set by the resource xaml-file.
How can I do this other then to set it by code....
Is it possible to include an event handler reference in a data template that is not associated with the code-behind where the event handler is defined? I'm getting a PARSER-BAD-PROPERTY-VALUE when trying to pull this off.
For example, let's say I have this very simple XAML.
page.xaml
<DataTemplate x:Key="ItemsTemplate">
<Hyperli...
I have UserControls containing other controls. I want that if I set a Foreground color for the UserControl, all child controls automatically inherit it. I have the same problem with font style/size.
Can I set these properties somehow to auto/inherit? Is this possible to set all subcontrols without a loop?
...
Hello!
I created a WPF application that has many buttons.
Now the customer wants to change all the buttons to icons.
For example:
All the OK buttons should have the same icon, all the cancel btns and so on.
I want to put in all the buttons Style="{StaticResource ButtonStyle_OK}", Style="{StaticResource ButtonStyle_OK}" etc.
Now my qu...
I'm looking for something along these lines:
<TextBlock
Grid.Column="1"
Text="Welcome, {Binding UserName}!" />
This will of course actually display the text "{Binding UserName}" to the user rather than decode it, but I know you can do something like this with ASP.NET, so I'm hoping there's a way to get this to work in WPF.
I'...
I have an issue with regards to using a ScaleTransform on a Canvas in Silverlight, the Canvas scales correctly, however the Height and Width values always remain the same.
e.g. a 100x100 Canvas scaled so it appears 200x200 is still 100x100 with regards to the Height and Width values, how can these be updated to reflect the new size.
A...
Following on from my other post about primary keys I am wondering if there is a performance impact in using a string value as the key in WPF comboboxes. For example
<ComboBox x:Name="TestCB" ItemsSource="{Binding Path=Products}" DisplayMemberPath="ProductName"
SelectedValuePath="ShortCode" SelectedValue="{Binding Pat...
Still picking my way through learning XAML/WPF. If someone can show me how to accomplish the following - it will go a long way to helping me develop my next project (and several similar projects down the road).
Say I have a collection of objects that defines objects to be drawn on a canvas. The objects contain all the information neces...
I have a template called template1.xaml and when I call this in Page.xaml and bind a string to the custom control property called "Title" it works. for example:
<Local:template1 Title="My Title" />
works in Page.xaml, but if I want to use Resx binding like this:
<Local:template1 Title="{Binding Strings.Hello, Source={StaticResource S...
I want to set the style of some controls on my UserControl, but can't seem to find the right syntax:
<UserControl x:Class="HiideSRM.WIDSModule.BiometricStatusIndicator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
...
Here's a much-abbreviated sample of my code.
<Grid>
<Polygon
Name="ply" Grid.Column="2" Grid.Row="0" Grid.RowSpan="3"
Fill="Orange" Stroke="Orange" Points="0,1 1,3 2,2 2,0 0,0"
/>
<Line
Grid.Column= "{Binding ElementName=ply, Path=Grid.Column, Mode=OneWay}"
Grid.Row= "{Binding ElementName=ply, Path=Grid.Row, Mode=On...
If anyone know where to download XAMLPad? Or you know better alternative to test WPF?
Thanks
...
I believe this code may require more effort to comprehend than average, so I'm using contextual code-comments to explain my predicament in an effort to make it a little easier to understand my question.
public class MyControl : System.Windows.FrameworkElement
{
public double Property1 { get; set; }
public double Property2 { ge...
Quite often when coming back to Visual Studio from Expression Blend 3, I see that Blend has helpfully added a "d:LayoutOverrides" property to my XAML. Growing up with ASP.NET designers, I naturally distrust anything I wouldn't type myself, so remove them as soon as I see them.
I know that "d:" properties are designer-only and don't imp...
Does anyone know how to "format xaml" in Expression Blend similar to the option "Format Document" in Visual Studio?
...
I'm trying to draw a line with soft edges, regardless of the slope.
Here's the code I have so far:
<Line HorizontalAlignment="Stretch" VerticalAlignment="Center"
Stretch="Uniform" StrokeThickness="5" X1="0" Y1="0" X2="1" Y2="0">
<Shape.Stroke>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<...
I am trying to get access to a textbox (textBoxAnswer) in the code behind of my WPF Page. The trouble is, because it is part of a DataTemplate, it is not auto-generated as a private member of the class, like it would be if I wasn't using the ContentPresenter + DataTemplate. (I am using the DataTemplate because I need to use DataTriggers,...
Please take a look at the following snippet:
<EventTrigger RoutedEvent="Image.MouseUp">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="TranslateTransform"
Storyboard.TargetProperty="X"
From="1" To="0" Duration="0:0:0.15"
/>
<DoubleAni...
Hello everybody,
I have a custom panel that has a public dependency property MaxItemsCount(defines the maximum number of elements in the panel), and I am giving this panel as an ItemsPanel to my custom control.
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<myPrimitives:MyPanel MaxItemsCount="5"/>
...