xaml

WPF/XAML: How to change a borders background with a colorpicker

Hello everybody, i have a xaml resource file with some definitions of datatemplates. In one datatemplate i have a border background bound to a property of its dataobject. I also have a colorpicker user control which is part of the contextmenu of the border. Now i'm trying to bind the dependency property "CustomColor" of the colorpicke...

How does one "disable" a button in WPF using the MVVM pattern?

I'm trying to get a grasp on WPF and MVVM and have been making good progress. The WPF and MVVM side of things are going well. However, the XAML and data binding side is a whole other story :) How would I go about "disabling" a button? For example, I have a CanClose property in my view model that determines whether or not the applicati...

XAML styles in Silverlight not being recognized

I am attempting to create a Syles.xaml file for my test Silverlight app. Here is what I have in the App.xaml file: <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:navigation="clr-namespace:System.Windows.Controls;assem...

WPF, property bound to dependent ComboBox always gives initial value

I have a ComboBox that needs to depend on the value of another ComboBox. This part already works, with the dependent ComboBox refreshing when a new value is chosen in the independent ComboBox: <!-- Independent --> <ComboBox Height="23" HorizontalAlignment="Left" Grid.Row="2" Grid.Column="2" x:Name="cbo_product" VerticalAlignm...

Specifying a WPF's databound attribute's design-time value in XAML

I'm playing around with a Canvas inside of a Viewbox, and unforunately, the only way to see the elements in the Canvas, I have to assign it a Height and Width. However, the problem is that my Height and Width values come from my ViewModel via databinding. I know that Blend gets around this with the d: designer namespace, which is set t...

Render XAML with remote images

I'm working on a tool that renders pieces of XAML to images.The XAML is used as a template to design the images. Due to the way the rendering works it is not possible to use a codebehind. Rendering just xaml is no problem. In one of my templates I want to give the renderer a lat/long and include an image from google maps, among other i...

WPF: How to pass whole Control as CommandParameter via XAML?

Hi I'm using MVVM and custom ICommand objects are provided by ViewModel layer. One ViewModel object at the same time can be attached via DataContext property to many View objects (windows, pages, etc). In ICommand.CanExecute() I want to check absence of validation errors for some controls in View (which attached to ViewModel props, sign...

Cannot set ComboBoxItem.IsEnabled to a Binding

I've had a day full of Silverlight idiosynchrasies, including this little doozy: <ComboBox> <ComboBox.ItemContainerStyle> <Style TargetType="ComboBoxItem"> <Setter Property="IsEnabled" Value="{Binding IsEnabled}"/> </Style> </ComboBox.ItemContainerStyle> <ComboBoxItem>First</ComboBoxItem> <Co...

How to layout controls in the top right hand corner in XAML/Silverlight?

I am going through the process of designing my first Silverlight application based upon the PivotViewer control from Silverlight 4. I am having problems organizing the bar at the top as per my design: I have found ways of left aligning the Logo and Title, a way of right aligning the buttons with various combinations of panels however ...

Unable to Databind derived property in XAML

I’ve got a property in a base class (view model), which when used in data binding in XAML doesn’t show up. It does however show up when I move that property to the derived view model. Why? XAML: <TextBlock Margin="5,0,0,0" VerticalAlignment="Center" Text="{Binding Path=ResxMessages.SelectPathToDevice}" /> Code Behind: public abs...

WPF Toolkit Chart control binding

Hi all I have a data table. This data table is processed through a class and results in a set of DataSeries. These consist of a name and list of DataPoint. DataPoint contains X and Y values, along with a tool tip. The user can chose 1 grouping level (which results in one DataSeries) or two grouping levels (which results in many DataSerie...

Adding an Image in xaml code?

How can I add an image to my program in XAML? I want to display the 'no.png' image on my application. Also, I need both yes and no to appear in the same place. My plan was to set them both to hidden and display them only when necessary. How can I do this? ...

WPF binding not applying to target after initialization

Hi all I am trying to add Series binding to the Visifire graphing controls set. To this end i have created a SeriesSource dependency property of time DataSeriesCollection. This is bound in the front end using: `<Chart SeriesSource={Binding Series} />` Problem When the source changes, the validation callback is called. The value th...

WPF: TextBox resizes inside ScrollViewer

I have a TextBox that stretches to the width of the window: <Window ...> <TextBox VerticalAlignment="Top" /> </Window> However, the textbox should have a minimum width, and I want scroll bars to be shown, if the textbox cannot be displayed fully. Thus: <Window ...> <ScrollViewer HorizontalScrollBarVisibility="Auto"> <...

Repeatedly losing XAML intellisense in Visual Studio 2010

I'm using Visual Studio 2010 to edit XAML for Silverlight (4). On a daily, or even hourly basis I lose my XAML intellisense randomnly. Often I'll get a whole page of valid XAML smothered in blue underlines from Visual Studio 2010's parser getting confused: Here is one of the errors: Error 6 The type initializer for 'Microsoft...

The file is not part of the project or its build action property is not set to resource.

Here's a screenshot: How can I display the 'no.png' image? It seems changing it to Resource worked. How can I change the image in my code-behind c# file? imgStatus.Source = new ur??? ...

Setting an Image to my Image control.

private void SetShipmentStatus(bool status) { if (status) { txtStatus.Text = "Su envio fue entregado!"; imgStatus.Source = ??? } } How can I give my XAML Image control a source programatically? I have the image in this location as Resource: ...

How to define DataContext in XAML using StaticResource

I want to declare a DataContext through a static resource in XAML as a binding for the Customers in the Northwind database. I can do this easily in code (C#) but want to learn how to do in XAML. I have tried all of the examples I can find but none of them work for me. I believe the issue is in the two XAML lines of code I have labeled [O...

Silverlight: How to implement CodeBehind code in XAML

There is an int property of the 'CustomControl' (in Silverlight 4 application), TextBlock is displayed inside of the 'Canvas' control: <Canvas Name="canvas" > <Ellipse Fill="Yellow" Canvas.Top="8" Canvas.Left="8" Height="16" Width="16"> </Ellipse> <TextBlock Name="TeamNumberTextBlock" Text="9" Canvas.Top="8" Canvas.Left="8" ...

XAML usage question

Hi, As far as I know, XAML is only used in WPF and Silverlight, isn't it? Thanks. ...