xaml

Referencing a custom obj, declared as a static res in xaml, is null. Why?

I have a small Silverlight 3 test application. This is an exercise in learning Silverlight, XAML, binding, etc. I have a small test class (Test), which has three properties; Val1, Val2, and Sum. I have declared a resource in the XAML as follows: <UserControl.Resources> <app:Test x:Name="xamlTestObj"></app:Test> </UserControl.Reso...

How to apply a template for every screen in sketchflow?

How do i apply a common template to every screen in a sketchflow project. I basically want some common navigation on the top and side and don’t want to have to draw it on every screen. ...

Creating a custom fill brush in XAML

How do I create the following shape in XAML? <Ellipse Height="100" Width="100"> <Ellipse.Fill> ??? </Ellipse.Fill> </Ellipse> LinearGradientBrush can't be transformed in this way? RadialGradientBrush is not suitable either. Any ideas? ...

Problem with IsIndeterminate while trying to put together a ProgressBar XAML template

Hello I´m creating a XAML template for the WPF ProgressBar. The following XAML code works fine if IsIndeterminate is set to False: <ControlTemplate x:Key="DefaultProgressBarTemplate" TargetType="{x:Type ProgressBar}"> <ControlTemplate.Resources> <SolidColorBrush x:Key="SolidBorderBrush" Color="#767676" /> <LinearGr...

ResourceDictionary element or UserControl?

I have some XAML to draw a logo and I want to re-use this in various other XAML files (it has no UI and requires no code). The top level of the logo XAML is a Canvas item. To use the logo in other XAML files is it best to define this logo as an element in a ResourceDictionary or create a UserControl? This seems easy with a UserControl...

Problem with Binding Dependency Property on a UserControl

I have a two userControls (IconUserControl & DisplayUserControl), I'm having a problem with binding dependency properties, here's some detail: IconUserControl has a bool DP of IsDisplayShown DisplayUserControl has a bool DP of IsDisplayShown In the XAML I have: <local:DisplayUserControl x:Name="DisplayUserControl...

WPF Popup Control - Find X, Y Coordinates

I'm trying to get the X,Y coordinates of a popup control. I have tried: VisualTreeHelper.GetOffset(Popup); but the vector returned always contains (0,0) for X and Y. The parent of the popup is the layout root, which is a grid. The CustomPopupPlacementCallback also always returns 0,0 for it's Point parameter. The goal is to allow th...

Is it possible to view effects of data triggers in design in Expression Blend 3?

Blend supports displaying the graphical representation of a style resource, and allows you to select an active property/event trigger to view or modify. However, it's a common occurrence to have visual elements controlled by DataTriggers. Is it possible to tell the designer that it should consider a DataTrigger 'active' so that its visua...

How to change ListBox DataTemplate in WPF based on CheckBox

I am trying to apply a DataTrigger to change the DataTemplate for a listbox and am getting the error "Error 1 Cannot find the Trigger target 'IssueListBox'. (The target must appear before any Setters, Triggers, or Conditions that use it.)" I have a Listbox in my Main Window (In a DockPanel along with other Controls): <ListBox x:Name...

TemplatedParent Binding in ControlTemplate.Triggers

When its text is empty, I am attempting to set the background of a custom control to a visual brush using a trigger in the ControlTemplate. The following shows the relevant code: <ControlTemplate.Triggers> <Trigger Property="Text" Value=""> <Setter TargetName="MyBorder" Property="Background"> <Setter.Value> <VisualBr...

Get SelectedItem from listbox in code behind

I have a ListBox populated with a list from ImageDomainService (RIA Services). I want to select one image from the ListBox and show the bigger version of the image beside it. Images are stored separate in /images/ folder How do I get the ImageName binding from ListBox to the url string in code behind like below? void AlbumView_Loaded(o...

Formatting multiple bound field in one TextBlock in XAML

I have 2 fields that I'd like to format into a TextBlock, example: "{0} of {1} hours used". Currently have: <TextBlock Text="{Binding HoursEntered}" /> <TextBlock Text=" of " /> <TextBlock Text="{Binding EstimatedHours}" /> <TextBlock Text=" hours used " /> Was looking at StringFormat for a single field, however this appears to on...

How to wire up a progress indicator

I have a circular progress indicator. I'd like to add this progress bar to an application I'm working on but don't know how to wire it up correctly. In my app, I want to hit the "Process" button and have the progress bar displayed while the data is being processed. When the processing is complete, I want the progress bar to hide. I don...

Event handlers in XAML or Code Behind

I am new to Silverlight and XAML. While trying to learn the syntax and best practices I continue to come across a discrepancy (or at least to me it seems that way) in the way some implement event handlers. In an example from MSDN I see the following code used: <UserControl x:Class="DragAndDropSimple.Page" xmlns="http://schemas.mic...

How to access base datacontext in Collection in xaml

I have a wpf app with the datacontext set to an instance of a viewmodel class. It all works fine except where I need to access a property of the viewmodel in a listbox with the datacontext set to a collection that is contained in the ViewModel class. On msdn it says you can escape using the \ character but that has not worked for me My ...

Visual Trick in XAML for Sivlerlight

I am trying to create a control which is basically showing a list of pictures in Silverlight, but I want the list to rotate in a sort of 2.5D way. You can think of it as the picture in the middle is YOU, and the others are your friends on social networking site. Here is a sketch of what I mean: As you click the green arrows, the pic...

UserControl exposing multiple content properties! How exciting that would be!

I am trying to create a UserControl that will hopefully be able to expose multiple content properties. However, I am ridden with failure! The idea would be to create this great user control (we'll call it MultiContent) that exposes two content properties so that I could do the following: <local:MultiContent> <local:MultiCon...

Get ProgressBar to fill StatusBarItem

Hey guys, I have a status bar that I'd like to house a TextBlock docked to the left and a ProgressBar filling the remaining width. In all my other experience with the WPF ProgressBar it will fill its given container, however in this situation it doesn't auto-size at all, it just appears as a tiny circle. Setting its height and width man...

WPF: Binding a ItemsSource to a Directory

I'm trying to do my first WPF project, and I've started with this sample project for image display. Part of it is the XAML that binds a Listbox to an Array of images: <ListBox.ItemsSource> <x:Array Type="{x:Type ImageSource}"> <ImageSource>http://static.flickr.com/34/70703587_b35cf6d9eb.jpg&lt;/ImageSource&gt; <Image...

How to get a ScrollViewer to be an exact height *and* show both scrollbars at all times?

I have a DataGrid inside a ScrollViewer. I want the whole thing to only be 200 pixels high. But this code: <ScrollViewer x:Name="DataGridArea" Height="200"> <toolkit:DataGrid ItemsSource="{Binding FieldChanges}"/> </ScrollViewer> produces this with the scrollbar only on the right side: and I can only see the scrollbar when I ...