xaml

How to define and use resources in xaml so they can be used in C#

Hi ! Theoretically, I think that I can define Brushes and Colors etc. in an xaml file and assign that to a button.background in c#. But how do I do that? Where do I put my lineargradientbrush definition like this: <LinearGradientBrush x:Key="BlaBrush"> <GradientStop Offset="0" Color="Red"/> <GradientStop...

Databinding to the value of a multiBinding

Maybe I am not quite grasping multibindings. I have a property on my viewmodel called OfficeDisplayName that is written to the database. This is a concatenated field based on a person's FirstName, Lastname, and office location. So I have a multibinding on a textBlock...no biggie...works beautifully...but how do I bind the full value ...

Fire xaml page in new web browser

Greeting, I have 2 xaml pages in my silver light application. First page has a button. I want when I click this button to fire the second xaml page in new web browser. please advice how to do this. Thank you, ...

Silverlight ToolKit DragDrop problem

Hi! I have pane with two grid and there is a listbox in both grid. I'd like to add Drag & Drop feature to the pane, so the user can drag a list element in the left listbox and drop it in the right listbox. I found many great tutorials and I could add the appropriate code to my pane but when the application is running and I click on the m...

How do I convert a Color to a Brush in XAML?

I want to convert a System.Windows.Media.Color value to a System.Windows.Media.Brush. The color value is databound to a Rectangle object's Fill property. The Fill property takes a Brush object, so I need an IValueConverter object to perform the conversion. Is there a built-in converter in WPF or do I need to create my own? How do I go a...

WPF Datatrigger for DataGrid only changing the entire row

Hi, I've got a datagrid with a datatrigger set. When it's value is "UP" I'd like the trigger to only change the background in the 'directionColumn' datagridcolumn only. What i've got so far updates the entire row. I also tried placing 'targetname' in the setter element but that just gives an error. Please help Thanks the xaml: <...

How can I get the effect of colored vertices in WPF 3D?

Those in the know know that the D3DRS_COLORVERTEX Render State, present in every version of Direct3D since at least version 5, is not found in WPF 3D. The question is: How can you approximate colored vertex data, with gouraud shading, using WPF 3D? Optimally, I just want to be able to assign an RGBA color to a vertex. And presumably, I'...

Silverlight XAML - set child item properties

I've got a Grid in my XAML page. The grid is simply a holder for XAML loaded from the database: <Grid x:Name="dynamicXamlHolder" /> I want all <TextBlock> objects that get inserted into that grid to have .TextWrapping = Wrap. How can I do this? I'm sensing styles might be the answer, but it's unclear to me how to create a grid style...

Making columns in a WPF ListBox

Hi, Problem: I have a set of items which have 3 elements: Image Description Numeric Value I want to display these in a ListBox (similar to the way Excel displays emails in the summary view) however, i do not know the width of the description field. If i dont set a hard coded value for the width in the ItemTemplate im using for the...

wpf - how do I apply same margins to all elements in a panel?

Is there a way of automatically tells all children items (e.g. labels, textboxes etc) to have a margin of 5, within a panel (e.g. dockpanel)? i.e. as opposed to having to set the margin for each element separately - also noting setting the margin on the panel itself is no good as then the panel has the margin not the elements. by the w...

[wpf] Error while increasing Opacity property using DoubleAnimation

Hi every body! I have a style for a ListViewItem control: <EventTrigger RoutedEvent="ListViewItem.MouseEnter"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="BitmapEffect.Opacity" ...

How to bind non-existing IsEmpty property of listbox?

Hello, I have a form and a button should be enabled only if the listbox is not empty. How can I do binding for this case? Note: I would like to avoid creating custom converter. Thanks! ...

WPF flv files Mediaelement

Hi, Is it possible to play flv video's from youtube in a WPF mediaElement? I tried it but the MediaOpened is not raised and the video dont start. Normal .mpg movies are working fine with the same code. ...

window.Owner (behavior expected)

what am I missing having this code behind on a XAML window // Create a window and make this window its owner Window ownedWindow = new Window(); ownedWindow.Owner = this; ownedWindow.ShowDialog(); I don't see the behavior http://msdn.microsoft.com/en-us/library/system.windows.window.owner.aspx Once this relationship is established, the...

Filtering a hierarchical object displayed with nested xaml data templates

I'm having trouble filtering hierarchical data that's being displayed in nested xaml templates. I've got a ObservableCollection<Foo> Foos, that I'm displaying in XAML. Lets say Foo looks like: class Foo { public ObservableCollection<Bar> Bars; } class Bar { public ObservableCollection<Qux> Quxes; } I'm displaying Foos with ...

wpf popup doesn't close when focus is lost in xaml

Hi, I've written following xaml code to show a popup with the content in a expander control. all the things work ok up to the position where the popup opens when the button is clicked. but the popup wont close when I click away from it. plus as soon as I click away to close the popup my whole application seems to be freezed for a little...

How to increase padding displayed items combobox?

I want to write XAML template of a combobox to increase the spaces/padding between items. I searched for this but almost end up with the ItemsPresenter: <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/...

Confusion about XAML namespace values.

I have read that xml namespace value is any arbitrary string value. But in the next paragraph in the book, I have read that : This namespace (xmlns:x) contains the required language components that are defined in the xaml specification, such as the ability to set an objects's name. Please anyone clear me this line. Because this strin...

Binding to properties outside of the datacontext

Hey all, I am creating a wpf application and am having a little difficulty implementing an user interface idea I have. I have a MasterViewModel bound to the MainWindow which exposes an observable collection of ViewModels. I have written some commands that essentially switch the current view model in the observable collection and this s...

XAML 2009 support in VS and blend

When can we expect XAML 2009 support in the tools like Expression Blend 4, Visual Studio 2010? Has Microsoft mentioned something somewhere publically? Willl we have to wait for Blend 5 and VS 2012? ...