xaml

WPF Button IsEnabled Based on ComboBox Selection Overwriting default style

I have a Button that is looking at 2 comboboxes to make sure they have a value before it is enabled. The problem is the way I am doing it is overwriting the default style declared in my theme project. <Button x:Name="btnOK" VerticalAlignment="Center" Content="OK" IsDefault="True" Margin="0" Click="btnOK_Click"> <Bu...

How does one create a WPF MarkupExtension with non-string parameters?

I am working on a Custom MarkupExtension within a WPF application. Every documented example I have seen uses string parameters from XAML to construct the new object. Is it possible to use a non-string parameter? In other words, how can I do something like this? [MarkupExtensionReturnType(typeof(Uri))] public class RefPackUriExtension...

Will Expression Blend relieve me from having to learn xaml?

I don't mind learning xaml and I'm sure I need to be familiar somewhat, but when I was first trying out Silverlight 1 with javascript it looked like a tremendous amount of overhead. I decided to wait until tools matured and asp.net was added. Well, asp.net has been added with Silverlight 2.0, and now I want to look at using it. But, x...

WPF GridSplitter Doesn't Work With WebBrowser Control?

I've been struggling with the GridSplitter. It seems to be incompatible with the WPF WebBrowser control. If I resize my window and move the GridSplitter, then I can make my grid wider than my window and non-viewable. Before: After: (note scrollbars) My XAML... <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presenta...

How can I animate a static object in a WPF storyboard

I have a WPF program to which I need to add a "Demo mode". Since I want my designers to be able to modify the demo mode without me having to recompile the program each time, I tough it would be a great idea to use a storyboard from an external XAML file. The "Demo mode" is basically a storyboard animating some of the application's depend...

What should the converter parameter be for this binding

I am trying to implement a wpf user control that binds a text box to a list of doubles using a converter. How can i set the instance of user control to be the converter parameter? the code for the control is shown below Thanks <UserControl x:Class="BaySizeControl.BaySizeTextBox" xmlns="http://schemas.microsoft.com/winfx/2006/xam...

Silverlight: Creating a round button template

I decided to try making a circular button, so using expression blend, I dropped a button control on my xaml. I then created a template from it by choosing "Edit Control Parts (Template)" -> "Edit a Copy". I am trying to design it so that the left and right sides of the button were always perfect semi circles, so that no matter how tal...

Silverlight: template binding

I'm trying to create a perfectly circular button, So I created a template from a standard button control using Expression Blend. A normal button has the BorderThickness property of the Background object (Border Type) bound to the template using template binding. If I wanted the border of my button to be customizable at design time, how...

Can you add an extra item to a data bound ItemsControl in XAML?

I have an ItemsControl that is data bound to a list of decimals. I need to add one extra control to the ItemsControl (an option to specify the number manually). Is there a way to do this in XAML? I know I can manually add the item in the code behind, but I'm trying to understand WPF a little better and want to see if there is a declar...

How to add nodes to a WPF treelist using VB.net (2008)

I need to create a wpf treeviewlist to look something like this: AAAA BBBB ....CCCC ....DDDD .......EEEE FFFFF (where the dots above are indents) I need to do this from vb.net (2008) code. I've spent an embarrassingly long amount of time trying to figure this out, and so far all I’ve got is: vb.net: Dim tvi1, tvi2 As TreeView...

How to style the slider control in WPF?

I want to style the slider control so that the height of the draggable thumb is set to 8 pixels. What is the simplest way to do this in WPF? <Slider> <Slider.Style> <!-- which xaml here? --> </Slider.style> </Slider> ...

Binding Visibility in XAML to a Visibility property

I've seen on the internet quite a few examples of binding a boolean to the Visibility property of a control in XAML. Most of the good examples use a BooleanToVisibiliy converter. I'd like to just set the Visible property on the control to bind to a System.Windows.Visibility property in the code-behind, but it doesn't seem to want to wo...

Load User Control dynamically and Default Namespace

In Silverlight, when you want to create a control dynamically, you must add the namespaces like this (as in http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx): XNamespace xmlns = "http://schemas.microsoft.com/client/2007"; XElement textBlock2 = new XElement(xmlns + "TextBlock", new XAttribute(XNamespace.Xmlns + "x...

Why XAML Width="Auto" does not work for me?

I have recently started maintenance on some poorly written XAMLs. I myself am relatively new to XAML. One thing I need urgently is - grid columns should automatically adjust their width as per the text contents. The MSDN documentation on GridViewColumn.Width says - set it to Auto to enable auto-sizing behavior. However even though the...

Moving .xaml and .xaml.vb files to a new Silverlight project breaks xaml compilation

When I move .xaml and .xaml.vb files to a new Silverlight project, the generated .g files no longer include members for the x:Name attributes defined in the xaml file. This means the code-behind files can't refer to those members and cannot build. ...

WPF: How to specify units in Dialog Units?

i'm trying to figure out how to layout a simple dialog in WPF using the proper dialog units (DLUs). i spent about two hours dimensioning this sample dialog box from Windows Vista with the various dlu measurements. Can someone please give the corresponding XAML markup that generates this dialog box? (Image Link) Now admittedly i know...

WPF: How to swap Listview cell content with a datatrigger (or equivalent)

I have a WPF App that implements a ListView. I would like to show an image (a small icon) in one of the columns depending on the type of the data that row represents. Sort of like the display you see in Windows Explorer. I am using DataTriggers elsewhere in my XAML, it seems like a similar method could be used to swap out entire cell c...

I18N and L10N in WPF through XAML.

Hi All, If anybody know how to do the Internationalization and localization in WPF through only XAML. I have already done through WPF .cs file by using Resource Manager class. I would greatly appericiate, if anybody can guide me and given me the code samples. Thanks in advance, Cheers... Karthikeyan Manickam. ...

How do you export from Expression Design to Silverlight XAML and retain vector relativity?

I am trying to export some prepared assets out of Expression Design 2 and into .XAML, with a final destination of Blend 2 for layout, but I cannot find a reliable way to keep the ability to resize those assets when they reach Blend. Taking a look at the exported final product, the XAML produced is wrapped in a Canvas (whether or not I se...

How do you attach to events on a ScriptObject in Silverlight?

The HtmlObject provides all the necessary functionality to register managed event handlers for script and DOM events, but what if the class you need to listen to doesn't exist as a DOM element, but a scripting variable (referenced via ScriptObject) instead? ...