xaml

Binding a property on on a great-grandchild to an ancestor

I'm not even sure how to express this, so im very sorry if the title is confusing.. My XAML (simplified) looks like this: <UserControl x:Class="PBA.Application.Client.UserControls.UserControls.FreqReserve.OverView" xmlns:FreqReserve="clr-namespace:PBA.Application.Client.UserControls.UserControls.FreqReserve"> ... <DockPanel> ...

Is hard coded XAML faster than code-behind generated XAML?

I have a WPF usercontrol which contains a number of textboxes and buttons. Currently these textboxes and buttons are all created and loaded dynamically into an ItemsControl through the code behind, whenever an instance of the control is created. The only hard-coded XAML is the declaration of the ItemsControl. This can be a bit sluggish ...

Silverlight get ListBoxItem from bound list

Hi, I have a ListBox in a file called Downloads.XAML. The items bound to that ListBox come from a bound list in my ViewModel. I have states that are defined in the ListBoxItem style in a different XAML control which need to be fired depending on a property set on the bound item. The problem I have is that I cannot get the ListBoxItem fr...

Silverlight Validation Not Working with Data Annotations

I have a form: <StackPanel x:Name="LayoutRoot"> <sdk:ValidationSummary /> <sdk:Label Target="{Binding ElementName=Greeting}" /> <TextBox x:Name="Greeting" Text="{Binding Greeting, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" /> <sdk:Label Target="{Binding ElementName=Name}" /> <Te...

Is there a way to render WPF controls on top of the wpf WebBrowser control?

I need an embedded WebBrowser control in my application, and am having problems displaying WPF content on top of it. The application will sometimes show popups for editing data or to display errors, and the WebBrowser is getting drawn on top of the popups because it is a WinForms control. The alternative I looked at here uses a Popup co...

WPF: How to open a ContextMenu from all areas of a Grid control

I'm trying to add a ContextMenu to items in a ListBox in WPF; <ListBox.ItemTemplate> <DataTemplate> <Border> <Grid> <Grid.ContextMenu> <ContextMenu> <MenuItem Header = "Menu item 1"/> ...

Can I use SizeChange event in XAML?

I want to change Button drawing based on button size using XAML. I know it is possible using c# code not sure about XAML Thanks Update : my code is like <Grid Width="60" Height="60"> <Ellipse Width="57" Height="57" StrockThickness="1"> </Ellipse> </Grid> I am applying above style to Button control. but here Width/Height...

Converting WPF Browser App to WPF Desktop App

Without copying all the code from one project to another, is it possible to convert an XBAP browser app into a WPF forms app? ...

WPF/Silverlight XAML: How do I bind a SQL bit field to a True/False combobox or listbox?

I store True/False values as bit fields in SQL Server. The fields are nullable. What is the XAML syntax to bind a bit field to a WPF combo box so the user can choose True/False or blank (null)? By the way, I'm binding to a strongly-typed dataset/datatable. Drag and drop binding has simplified binding to other datatypes. I certainly don...

How do I bind an enum to my listbox?

I have a Silverlight (WP7) project and would like to bind an enum to a listbox. This is an enum with custom values, sitting in a class library. How do I do this? ...

Silverlight / Expression: XAML build error

I'm getting the following errors: obj\Debug\StoryList.g.cs(40,22): error CS0102: The type 'Newsreader.StoryList' already contains a definition for '_contentLoaded' obj\Debug\StoryList.g.cs(46,21): error CS0111: Type 'Newsreader.StoryList' already defines a member called 'InitializeComponent' with the same param...

Map a class in XAML that isn't in a namespace

Yes I know this is considered bad practice, and for the most part I actually agree (i.e. no need to debate that point) but I'm wondering if it's possible to reference in XAML classes that aren't contained within a namespace. In other words, root-level classes. Again, I know this is bad practice, but I am curious. (BTW, yes I know abou...

Attached Properties in XAML without the word 'Property'

MS defines attached properties like 'Grid.RowProperty' and 'Grid.ColumnProperty', but in XAML you just call it with 'Grid.Row' and 'Grid.Column' I tried doing the same with an attached property called 'MyValProperty' that was registered with the name 'MyVal' on the class 'Foo', but the XAML won't let me type 'Foo.MyVal' and instead make...

Adding a ContentPresenter to the style of a Control

Hello everyone I'm trying to style an element in WPF which displays a yellow border around anything thats in it and shows a tool-tip when the cursor is over it. The problem is that I don't have much of an idea how to do this and anything I tried does not seem to work. Here is what I have until now: <Style x:Key="HistoryElementStyle" ...

WPF/XAML animation using own event

Hi all, I've used WPF for quite some time now, but I've never looked serious into animation. I'm trying to achieve the following, but until now, not successful. I have a class called "Property". This class has the ability to fire an event: public class Property { // ... public event System.Windows.RoutedEventHandler Attract; ...

How to load a grid from XAML codes and add it to a stackpanel dynamically/at runtime?

I generate the XAML codes which actually describe a valid grid control - called the GridXAML. I want to create a grid object and add it to a stackpanel on my form. How can I 1) create an object from its XAML string value, and 2) add it dynamically to a panel? Please help! Giving a specific sample context as below. The generated grid's...

What construct to use for a reusable, recolorable icon in XAML?

I am in the process of designing a small WPF based application, and I'd like to define some frequently used vector icons in XAML in a form, that is usable in multiple controls on one view, and recolorable through binding. For example, I'd like to a small cross icon change from black to gray together with the text in a disabled button, ...

How to extract all occurences of a specific tags of an xaml/xml file?

Let's say I need to extract all solid-brushes and linear-gradient brushes in a dictionary resource file using C#. How can I do it? Please help! This question can be extended to be more general like "How to find the multiple-lines match(es) when searching a file using C#?" ...

how i can change background combobox in silverlight?

Like this http://forums.silverlight.net/forums/p/62122/460886.aspx ...

Bouncing balls animation in Silverlight XAML only

In Silverlight, is it possible to do a "bouncing balls" style animation entirely in XAML - that is, with no code-behind at all? ...