xaml

Silverlight 3: Get value for current XAML filename

Hello, I am wanting to simply get the current XAML filename so I can make a decision in a user control. Any ideas on where this value lives in Silverlight 3? For example: if (currentPage == "home") homeLink.foreground = "white" elseif (cuurentPage == "settings") settingsLink.foreground = "white" ...

What options are there to make a list of labelled controls in Silverlight/WPF?

I have a lot of XAML that is in a complete mess and it's usually due to one thing. GRID, Grid.Column and Grid.Row craziness!! Now theres a few common ways you can make labelled lists in XAML:. With a <Grid> Advantages: Autosizing width of columns and rows Disadvantages: No easy way to insert rows/columns either in VS or Blend [STILL!!...

Silverlight xaml: building/concatenating Uris or other strings

I have a HyperlinkButton in a ListBox, the latter being bound to a list of items. I want the HyperLinkButton's Uri to be bound in this sort of fashion: NavigateUri="/some/url.xaml?tag={Binding}" Which obviously doesn't work, but you get the idea. Does anyone have a nice workaround for this? Preferably something compatible with WP7. Th...

Displaying rich text from database beyond capabilities RichText or htmlText.

I have thousands of quiz questions in a database which are in RTF format. The questions only change maybe once a month. At runtime, I need to choose a random subset of questions and display those questions in Flash/Flex. The formatting of the questions go beyond the capabilities of the RichText control or the HTML capabilities of a La...

Two way binding to a global 'boolean' in XAML?

There's quite a lot out there regarding binding a XAML StaticResource, such as a string constant to a XAML control. However I cannot find a good way to do two way binding in this scenario. I want to bind a global boolean to a checkbox which enables 'debugging' mode, that toggles visibility of certain things throughout my application. I...

Howto immediately update TextBox after correction of bound property?

Hello, i've made a binding from a TextBox to a Property. If the user write a date-value into the TextBox, it should be automatically corrected. f.e.: 20.01.10 -> 20.01.2010 The correction is done in the propertys set-block: public String DateOfBirth { get { if (patient.DateOfBirth != DateTime.MinValue) ...

What is the correct way to control a XAML controls fill color from c#?

I want to bind a control fill color to a boolean in c#, so if it is false, the color is Red and if it is true, the color is Green. Pretty new to XAML, but want to get into good habits from the start. Thanks, Ben ...

XAML nested binding StringFormat

I am trying to display an adress label. what i want is if AddresssLine2 is not an empty string (its never null) it should display it then a newline (I'm using VB, so its ), otherwise just display AddressLine2, which is an empty string, so in escense it is ignored. however, the StringFormat of the inner binding of AddressLine2 is complete...

XAML test data - designer can convert types but runtime cannot

I am designing a user control to display a note. So I have a NoteViewModel. In my designer I want to have a test note. So I have the following in my XAML: <UserControl.Resources> <local:NoteViewModel x:Key="ViewModel" d:IsDataSource="True"> <local:NoteViewModel.Note> <localweb:Note NoteID="1" ...

How to accomplish the Sliding Doors technique in XAML?

I have a rounded-corners button that I want to have a dynamically resizable width (static height) without changing the corner curvature. I'm trying a take on the sliding doors technique: an image for the left and right sides of the button, and a very long middle image. But I can't figure out how to make the middle image resize to only th...

Underline the implicit Textblock created in Silverlight for a ContentPresenter when Content is a string?

I am trying to create a template for a content control such as Button or HeaderedContentControl etc. where the text is underlined. I just want to underline the text when Content="This text is underlined" is specified. It must continue to work as normal if Content is another UIElement. Most posts asking this same question are satisfie...

Silverlight 4 and the ContextMenu control

I have the following piece of XAML code: <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu Height="75" Width="200" IsOpen="False" Visibi...

How to add sub menus to the ContextMenu control in Silverlight 4?

I have the following piece of XAML code: <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu Height="75" Width="200" IsOpen="False" Visibi...

Binding Errors in DataTemplated ListBoxItems

Currently i have a user control which contains a listbox of other visual element user controls; which (for this special case) have been data templated. <Grid> <ListBox ItemSource="{Binding Path=UserControlCollection}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> ...

Referencing Themes in a dll in WPF

Hi guys, I am using an opensource wpf TreeListView control. The control is a library project with a themes folder in it containing some xaml theme files. In my wpf project, I have got a reference to the control dll and I would like to know how to reference the dll themes in app.xaml. I tried doing something like this but it throws excep...

Where to find good resources to learn XAML?

I'm looking for (online) resources to learn/lookup XAML constructs. Can you recommend any good blogs, tutorials, references for XAML? ...

Problem building a silverlight project with MVVM-light on my PC. On other computers it builds.

Hello, I work in a team on a silverlight project. This silverlight project uses MVVM-light. When I want to build the project I get the following two errors: Error 1 : The type 'EventTrigger' does not support direct content. I get this error on this xaml code: <HyperlinkButton x:Name="HyperlinkButtonSelectAll" Content="Select all" IsTa...

How to make wpf row shrink to fit contents

I have a grid with two rows plus a grid splitter. I want the top row's height to be as small as possible by default (in this case, the height of the button) The bottom row should expand to take up the remaining space in the grid. I want the grid splitter there to allow the user to change the size as needed. <Grid> <Grid.RowDefinit...

TwoWay Binding with UserControl

I am trying to set twoway binding on a UserControl that I have created. When I use the control in Xaml is set the DataContext like so... <uc:MyUserControl DataContext="{Binding Path=MyObject, Mode=TwoWay}" /> My user control is defined as the following.... <UserControl x:Class="SilverlightApplication1.XText" xmlns="http://schema...

Prevent jumping of dynamically sized items in a WPF wrap panel.

I have a wrap panel full of rectangles, when you mouse over a rectangle it grows in size (using a storyboard animation) to simulate being magnified. That all works fine, the problem is that if you mouse over the last rectangle in a row the magnification causes it to jump to the next line (because it grew too big to fit on the current l...