xaml

WPF: Collision Detection between 2 ModelVisual3Ds

Hi, I would like to know when a ModelVisual3D has overlapped another ModelVisual3D (I am uncertain as if they are in the same Viewport3D or not). The models are in XAML form. I have searched and searched for a solution without success. ANY help would be appreciated. Thanks Q PS I am working with VB.NET - but will accept C# code. Th...

expression blend coloured regions

Hi, I am working with expression blend and c# to create a silverlight site. I would like to create a map of the world which has many regions. on clicking on the region the colour changes. I have already created the regions. Does anyone know how to do that? Thanks ...

Update field when property changes

This is probably a basic question, since I'm new to WPF.. I have a UserControl that contains a TextBox and a Button (code is simplified for this question) : <UserControl x:Name="this"> <TextBox Text="{Binding ElementName=this, Path=MyProperty.Value}"/> <Button x:Name="MyButton" Click="Button_Click"/> </UserControl> In the cod...

Animate opacity of ImageBrush within a Rectangle in XAML

I have an ImageBrush within a Rectangle that I'm trying to fade in on load, by increasing the opacity from 0 to 100. Here's what I have: <Rectangle HorizontalAlignment="Left" Width="200" Stroke="#FF000000" StrokeThickness="0" Fill="{DynamicResource MyImageBrush}" > <Rectangle.Resources> <ImageBrush x...

How can a custom markup extension for a graph of custom types loaded through XAML obtain a reference to the root object

I am attempting to write a MarkupExtension to support the process of instantiating custom types via XAML. My custom types are POCOs and not descendants of DependencyObject. There seems to be no straightforward XAML mechanism for MarkupExtensions to obtain references to objects in the graph that is being loaded. I note that the WPF machin...

WPF Listbox highlight part of ListBoxItem element

Hello, I have a TextBox and ListBox. User can search ListBox elements from TextBox. ListBox is bound to CollectionViewSource. CollectionViewSource has Filter event handler, that filters elements based on text that user enters into TextBox. My requirement is to highlight user entered text within TextBlock of ListBoxItem elements. I ...

How can WPF objects deriving from Freezable be frozen in XAML?

Many types in WPF derive from Freezable. It provides immutability to mutable POCO objects and allows for improved performance in certain situations. So my question is, how can I freeze objects in XAML markup? (Note that I have posted a similar but different question too). ...

Two Way Data Binding With a Dictionary in WPF

I'd like to bind a Dictionary<string, int> to a ListView in WPF. I'd like to do this in such a way that the Values in the Dictionary get updated via the data binding mechanism. I don't want to change the Keys just the Values. I also don't care about adding new mappings to the Dictionary. I just want to update existing ones. Setting the ...

XAML for Rotating, Round Image, with Transparent Center.

I'm looking for xaml that can represent a loading icon, like vista does. Visual Description: Round ( about 1/3 inch in width ) lighter blue color transparent center gel button looking (rounded edges wtih a little shadow) white spinner around the edge, to give the movement light(er) sky blue / gel pack looking I've found spinning ...

In WPF how can I bind to the ViewModel and have various XAML elements bind to the ViewModel's methods?

I can bind a ListBox like this: XAML: <UserControl x:Class="TestDynamicForm123.Views.ViewCustomers" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <StackPanel Margin="10"> <ListBox ItemsSource="{Binding}"/> </StackPanel> </UserControl>...

Why is this View not correctly binding to this ViewModel?

I'm trying to bind my view to my view model without DataObjectProvider. The following code runs without an error, but my ListBox is empty. As far as I can tell, I correctly: set the View's DataContext to the ViewModel itself (DataContext = new CustomersViewModel();) expose the customer objects in the ViewModel (public static Observab...

Can you define multiple TargetTypes for one XAML style?

In HTML/CSS you can define a style which can be applied to many types of elements, e.g.: .highlight { color:red; } can be applied to both P and DIV, e.g.: <p class="highlight">this will be highlighted</p> <div class="highlight">this will also be highlighted</div> but in XAML you seem to have to define the TargetType for styles,...

How can I get ScrollViewer to work inside a StackPanel?

In the following WPF XAML the ScrollViewer does not work (it displays a scroll bar but you cannot scroll and the contents go off the window to the bottom). I can change the outer StackPanel to a Grid and it will work. However, in my application from which I reproduced the following code, I need to have an outer StackPanel. What do I ha...

Attached Collection Items Losing Data Context

I created an attached property, AttachedBehaviorsManager.Behaviors that is to be used as an MVVM helper class that ties events to commands. The property is of type BehaviorCollection (a wrapper for ObservableCollection). My issue is that the Binding for the Behavior's Command always winds up being null. When used on the buttons it works ...

Save XAML file in database.

Hi, I have a Silverlight application in witch i can create presentation slides(like in PowerPoint), and i whant to save this slides(XAML and .cs files) in database or somwhere else, where i can be able to load and to use them. Regard, Andrei. ...

XAML thumbanil?

Can i create a thumbnail for an xaml content? Consider that i have a slide-xaml file:Canvas, ScrollView, etc., and i whant to create a thumbnail, (like in PowerPoint) and everything i do on my slide(add textBlock, button, etc) to can reflected(view) on my thumbnail. Regard, Andrei. ...

Why does ObservableCollection hide INotifyPropertyChanged.PropertyChanged

I have a class that derives from ObservableCollection. I wanted to add some properties to this class (not the items in the collection) but have discovered that its implementation of PropertyChanged is protected. Since its protected I assume that is why my attempts at binding to these new properties in XAML are failing. Short of creating...

TextBlock Text property can't be set via style trigger if non-empty - why?

The XAML below does not work (the text does not change when mousing over): <Window.Resources> <Style TargetType="TextBlock"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Text" Value="hover"/> </Trigger> </Style.Triggers> </Style> </Window...

Multilanguage in WPF

Can you recomend me a good way to implement a Multilanguage system for a WPF app? The method i'm using right now involves xml, classes and a xaml extension. Works fine in most of cases, but when I have to deal with dynamic labels or dynamic text in general it require some extra effort. I would like to let the programmer working only i...

Silverlight page added to html

Hey I have a silverlight page and I have a html page with my layout. How can I add the silverlight page to part of my html page? Thank you! ...