xaml

How does one go about debugging databinding issues in MVVM?

I have rebuilt Josh Smith's CommandSink example from scratch and my version runs without error except that my command buttons are grayed out. I assume this is because there is something somewhere not set correctly so that the commands never get set to CanExecute = true or at some point get set to CanExecute = false. But since the databi...

Scale a canvas inside a templated usercontrol

Hi geeks, I created a templated usercontrol from a button in order to use common states etc. What I dont get is how to scale a canvas inside the template. I created a little drawing with lines but they do not scale/transform with the control when I use it. Most interesting would be if that is possible using xaml element binding (I am pl...

Scrolling text update problems

I have some scrolling text animation modified from this post on MSDN. I'm having two issues with it, though. The first is that I need to be able to update the text within at periodic intervals. However, when OnTick() fires, I get the following error, "The calling thread cannot access this object because a different thread owns it." I'v...

Xaml Inherited Styles

Is there a way in XAML to set a style that will apply to all controls? For example below I would like to put a margin on all my controls. I can add a style for each type by change the TargetType to Button, CheckBox, etc. Instead, I would like to set it up like I have below where I set the style on all types that inherit from Control: ...

ItemsSource in WPF Declaritively into C# Programatically

Hey, Quick question, how do I convert this into back end code? i.e. c# ItemsSource="{Binding Source={StaticResource List1}, XPath=Entry}" Thanks ...

Any way to extract underlying Xaml?

Is there anyway to extract the underlying xaml from a control. IE. I have a textbox named fooBox. Can I get xaml back from the textbox at runtime that represents the textbox? ...

ASP.NET MVC & Expression XAML - How do I integrate?

Some Background: ASP.net MVC is primarly a paradigm shift in the way you structure and develop ASP.NET applications. Shifting from a "code behind" type of mentality to more of a standard MVC Ruby on Rails like mentality. I applaud it's efforts as a simlifying tool towards unit testing ease and seperation of code (although the html inl...

WPF: Changing Resources (colors) from the App.xaml during runtime

I am trying to make my application more customizable by allowing users to pick a color from a Color Picker dialog, and then changing the style of the application in real time (with DynamicResource) How do I go about in changing specific resources that reside in the app.xaml ? I have tried something like this but no luck (just a test)...

XamlReader.Load(XmlReader) "Stack Empty" XamlParseException

I'm trying to load a xaml file at runtime. My code looks like this: StringReader stringReader = new StringReader(xamlString); XmlReader xmlReader = XmlReader.Create(stringReader); content = XamlReader.Load(xmlReader); It's basically copy paste of of msdn. the XamlReader.Load line throws a XamlParseE...

Silverlight Control Toolkit TreeView not rendering items

I'm trying to build a SL app with a TreeView in it. Here's my XAML: <UserControl xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:tkwin="clr-namespace:System.Windows;assembly=System.Windows.Controls.Toolkit" xmlns:basics="clr-namespace:System.Windows.Control...

Free/Paid Silverlight Video Players?

I'm looking for some nice looking silverlight video players to be used on a website. Similar to this question regarding flash: http://stackoverflow.com/questions/167072/free-paid-flash-video-players, I'm looking for some good silverlight skins. Any good resources available? I'm aware of: http://www.longtailvideo.com/players/jw-wmv-pl...

WPF: Basic question about Dependency Properties

I have the following Xaml in a Window (ArtistInfo): <Grid> <TextBlock Text="{Binding Artist.Name}"></TextBlock> </Grid> And this is the code-behind for the same window (code simplified for question's sake): public static readonly DependencyProperty ArtistProperty = DependencyProperty.Register("Artist", typeof(Artist), ty...

WPF: Having hardcoded text with a binding in a TextBlock

In WPF, is there any way to have the Text property of a TextBlock to contain both hard coded text and a specific binding? What I have in mind is something along the lines of the following (ofcourse, the below doesn't compile): <TextBlock Text="Number of Fans: {Binding Artist.Fans.Count}"></TextBlock> ...

How to bind resources string to Xaml in Silverlight

How to bind resources string to Xaml in silverlight? ...

Animating removed item in Listbox

I have some Listboxes in my app bound to ObservableCollections, and i would like to animate an item if it's being removed. I already found a question about animating added items by using the FrameworkElement.Loaded event, but of course that doesn't work the same way with the Unloaded event. Is there any way to do this in a way that ca...

How to bind ControlTemplate Enabled property to Opacity in WPF XAML

In WPF inside XAML how to extend a ControlTemplate as such that when applied to a button and the button gets disabled it fades to 0.5 opacity while disabled and once enabled fades back to 1.0 opacity. This visual effect should work also when a parent is being disabled. ...

Access XAML object from code

Hello I created a UserControl in WPF: In Xaml: <UserControl x:Class="OutlookPanel.MailRelation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300" xmlns:graph="clr-namespace:MyPanel" > <DockPanel> <graph:Graph Name="theGraph...

How to get DataTemplate.DataTrigger to check for greater than or less than?

The following DataTemplate.DataTrigger makes the age display red if it is equal to 30. How do I make the age display red if it is greater than 30? <DataTemplate DataType="{x:Type local:Customer}"> <Grid x:Name="MainGrid" Style="{StaticResource customerGridMainStyle}"> <Grid.ColumnDefinitions> <ColumnDefinition W...

How are you keeping your WPF resources organized on large projects?

On even the smallest WPF examples and prototypes I've been doing, the <Windows.Resources> begins to bloat fast. Putting it back into app.xaml puts it all out of my Windows and UserControls but it is hard to organize (the Visual Studio "XAML folding" feature is of no help since you just have a page full of the word "Style..."). In additi...

WPF Event: BitmapImage PropertyChanged: "Calling Thread Cannot access"

I'm trying to understand what it is about the following code that is perfectly happy with loading a text file and displaying its contents, but isn't happy with loading a BitmapImage and displaying it on a timer.Elapsed event handler. I understand it has to do with the UI thread. But why is this not a problem for the textfile example?...