xaml

How to use quote " character in XAML binding?

I'm trying to do this: <TextBlock Text="{Binding Path=Text, Converter={StaticResource stringFormatConverter}, ConverterParameter='\"{0}\"'}" /> But this is apparently not the way to get a quote into a XAML binding string. What is the appropriate way to get "\"{0}"\" to work here? ...

How to put a unicode character in XAML?

I'm trying to do this: <TextBlock Text="{Binding Path=Text, Converter={StaticResource stringFormatConverter}, ConverterParameter='&\u2014{0}'}" /> To get a to appear in front of the text. It doesn't work. What should I be doing here? ...

How Do You Create a Local Reference a TabItem ?

Trying to parse Maplines for an airport. Each airport can have X number of different configurations. In code behind I parse each configuration into a separate collection of custom objects which is data bound to the TabItem below. Currently this TabItem is "Hard Coded" in the XAML body. How do I create a template that I can declare fr...

How to bind a ListBox to Properties in a Class?

I have one main outstanding issue, I know now how to databind to lists and individual items, but there is one more problem I have with this, I need to bind a listbox to some properties that are in a Class. For Example I have two Properties that are bound in some XAML in a class called Display: Public Property ShowEventStart() As Visibil...

WPF Toolkit: Bug in Control Template?

Here's one for all you XAML wizards: The WPF Toolkit Calendar control (June 2009) appears to have a bug. The bug only crops up when you modify the control template for the calendar, specifically, the PART_CalendarItem. At the end of this message, I have included the XAML for a (Blend 3.0) window that declares a Calendar and assigns it ...

Set Window.Content to a page by XAML?

<Window x:Class="MyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:WpfApplication1" Title="ContactsSelector" Height="300" Width="300"> <Window.Content> <src:MyPage> <!--MyPage is a page that I c...

Custom Shape in Silverlight (porting app from WPF)

I'm converting a WPF app to Silverlight. The app includes a class which inherits from Shape. It overrides the DefiningGeometry property to return a Path object. However, the Silverlight Shape class doesn't have a DefiningGeometry property. Reading on the internet I've found others with this same problem. The solution seems to involve i...

WPF: ComboBox without dropdown button

I want a ComboBox which has no dropdown button but can still be opened when I click on the text in the combobox. Is this possible with a WPF combobox? ...

How can I have WPF use one window style for Debug mode and another for Release mode?

I have two different styles for my window: Regular - window has title bar and can be moved/resized Fixed - window has no title bar and is fixed at the center of the screen The window is too wide for either of the monitors on my development machine, but it's a perfect fit for the target/install machine. So, when debugging, I need to b...

How to set ComboBox.SelectionBoxItemTemplate in Silverlight 3.0

I need to be able to have a SelectionBoxItemTemplate for my ComboBox, but am unsure how to do this or if there is another way in Silverlight 3.0 to do this. In my drop-down list I have a List of CheckBoxes, and TextBlocks, this works fine, however the Selected Item is one of these when I click on it, i.e. the Checkbox shows in the top of...

WPF: StackPanel item auto-height question

I have a Stackpanel and want that the items automatically set their sizes regarding to their contents but the items should not automatically fill the height of the Stackpanel (But Stackpanel should have auto height according to largest item). I also tried WrapPanel which has the same problem. I want the TextBox "test" be be vertically c...

How to dynamically load internal xaml in Silverlight 3 at runtime?

I have a few internal Canvas xaml files which I want to load dynamically at runtime. For example, I want to display the Canvas in a page. However, I cannot seem to get it to work. I've tried using XamlReader, Application.LoadComponent, and using an XDocument; all to no avail. I cannot seem to find the best practice for this on-line ei...

How can I add a Path, that has been defined in the XAML ResourceDictionary, multiple times to a WPF form at runtime?

I have a defined path in XAML: <UserControl.Resources> <ResourceDictionary> <Path x:Key="N44" Width="20" Height="80" Stretch="Fill" Fill="#FF000000" Data="M 20,25.2941L 20,29.4118L 15.9091,29.4118L 15.9091,40L 12.2727,40L 12.2727,29.4118L 2.54313e-006,29.4118L 2.54313e-006,25.6985L 13.4872,7.62939e-006L 15.9091,7.62939e-006L...

Inheriting from Silverlight Slideshow dll

Hello, I am trying to use the .dll of a slideshow project and inheriting the xaml(from the slideshow prj) in a new project so that I have the xap file needed as source for the Silverlight tag. In this way, I am trying to eliminate the need for including the Slideshow project(Source code) in the new project. Is this possible? If yes, pl...

Setting Column Background in WPF ListView/Gridview

I'm looking to set the background of a column in a WPF GridView. Many Google results have pointed towards setting the GridViewColumn.CellTemplate to change the appearance of a column. However, I'm met with an issue when setting the background color; it's not stretching to fill the cell: Here's the xaml I'm working with: <Window x:Cla...

Why can't I use the Name attribute on UserControl in the same assembly?

When I created a WPF UserControl and tried to use it, I got the following compiler error: Because 'UserControl1' is implemented in the same assembly, you must set the x:Name attribute rather than the Name attribute. The message is clear on what to do to fix it, but what is its cause? Why can't I use Name here? ...

Converting XAML Textbox to C# with Validation

Hello I am trying to convert this xaml textbox with validation into C# so that it can be dynamically created and populated from code. I am getting stuck creating the validation bindings. Can anyone provide any hints? <TextBox Height="20" Width="200" > <Binding RelativeSource="{x:Static RelativeSource.Self}" Path="Text" > ...

WPF: Embedding TextBoxes in TextBox

Is is possible to embedd a TextBox in another TextBox. It does not have to be a TextBox, any editable text-component will suffice. I tried it with TextBox and got compiler errors. Reasoning: I want to create some kind of source code editor. I want that string literals in my source code are allowed to contain all kinds of special charact...

WPF: Localizing text that contains links

I have this window where I have a block of text that contains a link. Something like: Click here to read the documentation. Which means only the "here" in the sentence is a hyperlink. My problem is, I want to prepare this for localization. As a result, I have the text in resx files. So in the resx file I have "Click here to read the d...

Manually instantiate a DataTemplate?

Is it possible to use a data template for a single item with no ListBox or other items control? I have a datatemplate that I want to instantiate in xaml, not in a list, just within a border, and set its datacontext. Something like (pseudo): <Window DataContext="{StaticResource Contact}"> <!-- Here I want to show a ContactT...