xaml

How do you align text so it is in the middle of a button in Silverlight?

Here is the current code I am using: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ButtonPrototype.MainPage" Width="640" Height="480"> <UserControl.Resources> <ControlTemplate x:Key="CellTemplate" TargetType="Butt...

How to measure a canvas that has auto height and width

Hi Folks, I'm a beginner in silverlight so i hope i can get an answer that brings me some more light in the measure process of silverlight. I found an interessting flap out control from silverlight slide control and now I try to use it in my project. So that the slide out is working proper, I have to place the user control on a canvas....

How to set Height of items in XAML so they always occupy the same proportion of available space in parent ItemsControl?

I have an ItemsControl with the following ItemTemplate: <DataTemplate x:Key="myItemTemplate"> <TextBlock Height="???" Text="{Binding Path=Description}" /> </DataTemplate> My question is, how do I set the Height of the TextBlock in the template so that it automatically assumes ItemsControl.Height div ItemsCount amount of vertical s...

What's the Best Way to Navigate Silverlight XAML in Visual Studio 2008?

When editing Silverlight XAML in Visual Studio 2008, the Document Outline panel is not supported by Microsoft. 1) Any helpful tip for navigating a deep XAML markup hierarchy without the benefit of the Document Outline tool? 2) Is this supported in Visual Studio 2010? ...

WPF Toolkit: Nullable object must have a value

Hi All, I am trying to create some line charts from a dataset and getting an error (WPF+WPF Toolkit + C#): Nullable object must have a value Here is a code that I use to add some data points to the chart: ObservableCollection points = new ObservableCollection(); foreach (DataRow dr in dc.Tables[0].Rows) { points.Add(new Vel...

WPF Some styles not applied on DataTemplate controls

Hi, I am trying to learn something about WPF and I am quite amazed by its flexibility. However, I have hit a problem with Styles and DataTemplates, which is little bit confusing. I have defined below test page to play around a bit with styles etc and found that the Styles defined in <Page.Resources> for Border and TextBlock are not app...

How can I unattach an element from another element in the XAML tree?

In my Silverlight application, I load all the images I need at application start and store them in a dictionary. Then as I need them I pick them out of the dictionary and attach them in XAML trees etc. However, I have the problem that if I attach an Image object to a Grid, then want to use that image again, it tells me: The image e...

How to set binding in xaml to my own variable

Hello. I have an object in the code: public class UserLogin { bool _IsUserLogin = false; public bool IsUserLogin { get { return _IsUserLogin; } set { _IsUserLogin = value; } } public UserLogin() { _IsUserLogin = false; } } .... ...

how do you set a property of a control to an address of a function in xaml?

Hi, I have a control that has a "Filter" property that expects a function that defines how the contents of the control should be filtered. so far i am setting the filter in code behind as such: MyControl.Filter = AddressOf Filters.MyFilter In this example MyFilter is a shared function in the Filters class with the following signatur...

How to create an array of buttons in WPF ?

I can create an array of buttons in Windows Form but how can i do that in WPF(xaml) ? thanks in advance! ...

How do you replace an entire xaml element?

<ListView> <ListView.Resources> <DataTempalte x:Key="label"> <TextBlock Text="{Binding Label}"/> </DataTEmplate> <DataTemplate x:Key="editor"> <UserControl Content="{Binding Control.content}"/> <!-- This is the line --> </DataTemplate> </ListView.Resources> <ListView.Vie...

User defined top level control in XAML

A normal UserControl looks like this in XAML: <UserControl x:Class="mynamespace.foo" ...namespaces...> <!-- content --> </UserControl> I'd like to be able to define my own top level object, along the lines of: <MyControl x:Class="mynamespace.mycontrol" ...namespaces...> <!-- content --> </UserControl> Where MyControl derives from a...

How do you fix the Silverlight application shift that occurs in the Firefox browser?

Hi, Currently I have an Silverlight application that when run on Firefox browser (ver 3.6) the entire contents of the Silverlight application shifts a little, and also the scrollbars on both the bottom and the side appear when I first use it. This does not happen in IE 8. How can I fix this in Firefox so it doesn't happen? The projec...

Serializing WPF DataTemplates and {Binding Expressions} (from PowerShell?)

Ok, here's the deal: I have code that works in C#, but when I call it from PowerShell, it fails. I can't quite figure it out, but it's something specific to PowerShell. Here's the relevant code calling the library (assuming you've added a reference ahead of time) from C#: public class Test { [STAThread] public static void Main() ...

XAML C# WPF Best efficient way to do an ordered sequence of animations

Hi everybody! I would like to do a sequence of animations on a label, for example, first do opacity animations from values 0 to 1 and vice versa and just at the end of opacity animation and not before a foreground animation. I would like to do it in XAML code and then start and finish de animation from C# code. Which is the best and eff...

Cannot access resource defined in app.xaml

I am using Visual Studio 2010 RC1. I define a resource "Brush2" in app.xaml_: <Application x:Class="VideoThumbnails.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources...

Embed XAML in XML Schema

I'm developping a xml data format. Besides other data there should be a xaml drawing. So I wanted to have a xml element, which can contain any valid xaml. How can this be expressed in the XML Schema? I tried to import the xaml schema, but I couldn't find a xsd file for it. The makeshift would be to use an encoded string. ...

What are good places to find free XAML images?

As I started using WPF at higher DPI resolutions, I got into troubles with scaling of toolbar images. XAML images solve that problem. However I find it very hard to find free toolbar/ribbon XAML images that you can use in your own projects. What I found is usually not free and one probably needs more than few collections to get all need...

WPF ToolBar: how to remove grip (dots on the left)

I use ToolBar for my WPF application. As I understand, there is no easy way to make it floating. I just want to remove element which I don't want to be displayed: several dots in the left side of ToolBar. Is there any Properties to customize view of ToolBar? Or, maybe, it's possible to redefine a ToolBar Template? ...

Add space between items in a WPF/Silverlight ListBox without space above first or below last

Is there a standard/best way to space items in a WPF ListBox, such that there is space between consecutive items, but not above the first or below the last? To me, the most obvious way to add spacing is to modify the ItemTemplate to include space above, below, or both above and below each item. This, of course, means that there will be ...