xaml

With WPF, how to link an animation with a ContentControl?

I don't know how to link successfully a StoryBoard to a TranslateTransform that is part of a ContentControl. I always get the following error when I try to run my StoryBoard: 'RenderTransform' property does not point to a DependencyObject in path '(Children).[0].(Content).(0).(1)'. I guess I don't know how to define a TargetPropert...

Unable to set System.Windows.Controls.MenuItem.Icon thru a setter

Hi I am trying to have a MenuItem.Icon set thru a style setter: <Style x:Key="MenuItem_Delete" TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}"> <Setter Property="Header" Value="_Delete"/> <Setter Property="MenuItem.Icon"> <Setter.Value> <Image Source="Resources/Delete.png"/> ...

WPF - How to make RadioButtons generated by a DataTemplate be mutually exclusive?

One of the apps I am building needs to build a survey for users to take. The relevant classes related to my question are: Survey (string Description, List<Questions> Questions, QuestionTypes Type) Question (string Description, List<Choice> Choices) Choice (string Description) enum QuestionTypes {MultipleChoicesOneAnswer, MultipleCho...

Set Window.DataContext to a declared property in the code-behind?

I want to achieve something like the following (Notice the DataContext property of the Window element): <Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding MyDataContext}"/> Class Window1 Public ReadOnly...

MultiBinding binded to elements question

Hi! I have a login form that contains a username textbox and a password box. I want the ok button to be enabled only when both the fields contain a value. I have a converter that check for all the strings if they're null or empty. I placed a breakpoint on the first line of the Convert method, and it stops only when the MenuItem initial...

Overriding method of an element within a XAML UserControl?

I have a Silverlight user control that has no template and does not need one as it is simply a path with a RectangleGeometry that is resized by code. Now our designed has added a template to the tooltip of the path and I want to be able to provide a method for users of the control to change the layout of a portion of this template. If th...

How to say XAML <Button Height="Auto"/> in code behind?

How can you set Height="*" and Height="Auto" in code behind? ...

Why can you inherit a class over project boundaries, but not its attached XAML?

(this question is a refinement of my other question on this topic which was a bit complicated but I really want to understand why this doesn't work so here's a more straight-forward example) WHAT I WANT TO DO: create a simple class (no XAML) in one project which inherits a WPF UserControl (with XAML) in another project. Here is my inhe...

WPF/XAML - hide image if another control's text property is empty/not set

hello everybody, i'm new to wpf and this is my first attempt of creating a custom user control. its purpose is to display two values (myText1 and myText2) with their corresponding images (myimage1, myimage2). sometimes, one of these values is not set and therefore oneimage should be hidden as well. here's my code so far: Window1.xaml ...

How to databind to a property in a WPF Usercontrol?

Hi, I have a Usercontrol in a UserControl libracy (seperate assembly) i have in my xaml markup like this: <UserControl x:Class="CenterTextTemplate.CenterTextTemplate" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="Test" Height="Auto" Width="Auto">...

XAML Coding Guidelines

There is a plenty coding guidelines/standards available for c# language. However I couldn't find anything "official" regarding XAML. I'm particularly interested in naming conventions of the visual elements, but something about formatting would be also useful. At the moment my XAML files look like a big soup of tags, not really human read...

How to get XamlReader.Parse to not throw "property does not exist" XamlParseException?

I'm using XAML for serializing some objects and it's working great for the most part. The problem I'm now facing is when I change the data structure all the old objects produce an exception like the one below. I don't mind if the values are lost. Is there a way to turn off these exceptions and just have the xaml reader ignore unknown ...

Is there a Visual Studio (or freeware) equivalent for Expression Blend's "Edit Template" feature?

In Expression Blend, you can view and edit the control template of objects in the "Objects and Timeline" panel. I'm wondering if there's an equivalent feature in Visual Studio or if there's something free (or very inexpensive) I can download that will allow me to do this. Here's a screen cap from Expression Blend that shows what I'm tal...

Free XamlPad Alternatives

I was using the XamlPad from the .NET SDK, so I did a quick search for something similar but with more features and utility. My search turned up multiple alternatives, so I was wondering if anyone had any specific recommendations on which XamlPad alternative to choose. ...

WPF/XAML - compare the "SelectedIndex" of two comboboxes (DataTrigger?)

hello, i've got two comboboxes with the same content. the user should not be allowed to choose the same item twice. therefore the comboboxes' contents (= selectedindex?) should never be equal. my first attempt was to comapare the selectedindex with a datatrigger to show/hide a button: <DataTrigger Binding="{Binding ElementName=comboBo...

wpf custom control xaml null error

Yet another strange WPF error: I have a custom control in a simple XAML page. The project builds and runs perfectly, with no errors. Here's the XAML: <Window x:Class="Grapher2.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:graph="clr-namespace:Gr...

WPF TreeListView

Hi everyone! I was wondering if anyone knows how to use the TreeListView in WPF/XAML/Expression Blend. Without using the code behind. This what I want to do. I would like to populate a TreeListView with information, if the information's client and matter are the same, then just make that item a child of it. Example: Client 1= Kevin, ...

Refresh designer in Blend

Either I'm not as intelligent as I once believed or the UI in Blend is really this bad. Is there any way to 'refresh' changes I've made to an XAML file in the designer? Something simple like changing 'Fill="Red"' to 'Fill="Blue"' does not show up in the designer unless I close and re-open the file. Google and SO were sadly and surpri...

Bind silverlight combobox to the result of another combobox

I want to do something like this: <combobox x:Name="cboCustomers" ItemsSource="{Binding Path=Data.Customers}"/> <combobox x:Name="cboInvoices"ItemsSource="{cboCustomers.SelectedItem.Invoices}"/> Anyone know of a way to do something like this in Silverlight 3? I am sure there is some information about it out there, but I am having bad...

What do I use for `BasedOn` when creating a custom style for a DataGridColumnHeader in WPF?

What should I put for BasedOn in this style? <Style x:Key="DataGrid_ColumnHeaderStyle" TargetType="wt:DataGridColumnHeader" BasedOn="??????????"> <!-- I want this to be a reference to the default style --> <Setter Property="BorderBrush" Value="{StaticResource Media_RaisedBorderBrush}" /> <Setter ...