xaml

Silverlight XAML layout issue

Hello everyone, I am using Silverlight 3.0 + .Net 3.5 + VSTS 2008 + C# to develop a simple video application using the open source slvideoplayer of Silverlight. http://slvideoplayer.codeplex.com/ For the player, the play control is at the bottom of the rendering video, any ideas how to place play control at the top of video? I have tr...

Xaml to Display a Dictionary of Dictionaries

What Xaml is required to display a DataGrid of this dictionary of dictionaries? Public Property CharIndexedMatrixOfSingle As SortedDictionary(Of Char, SortedDictionary(Of Char, Single)) It's intended to display as bindable, editable (two way) n by n matrix of Singles. ...

Set Validation Tooltip in CodeBehind instead of XAML

I would like to know how to translate the following code to codebehind instead of XAML: <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Styl...

Non breaking space in XAML vs. code

This works fine, and correctly inserts non-breaking spaces into the string: <TextBlock Text="Non&#160;Breaking&#160;Text&#160;Here"></TextBlock> But what I really need is to replace spaces with non-breaking spaces during data binding. So I wrote a simple value converter that replaces spaces with "&#160;". It does indeed replace spac...

WPF MenuItem Content "Name"

Hi, I have a LOT of MenuItem(s), and I want to be able to change their "Content" so that it displays in the program. When I load up the program, their "Content Name" is set in a Setter I created.. but the only problem is that I have almost a hundred MenuItem objects, and I need their display names in the program to be different (not the...

How to have a user control as a ListBoxItem

I want to bind a user control (View) to a ListBoxItem. The ListBox is bound to a collection of ViewModels. I have set the ListBox's ItemTemplate as so: <ListBox.ItemTemplate> <DataTemplate> <View:ContactView/> </DataTemplate> </ListBox.ItemTemplate> But all I get are blank ListBoxItems. I can click on the...

Serializing WPF RichTextBox to XAML vs RTF

I have a RichTextBox and need to serialize its content to my database purely for storage purposes. It would appear that I have a choice between serializing as XAML or as RTF, and am wondering if there are any advantages to serializing to XAML over RTF, which I would consider as more "standard". In particular, am I losing any capability ...

WPF - Dynamically access a specific item of a collection in XAML

Hi, I have a data source ('SampleAppearanceDefinitions'), which holds a single collection ('Definitions'). Each item in the collection has several properties, including Color, which is what I'm interested in here. I want, in XAML, to display the Color of a particular item in the collection as text. I can do this just fine using this co...

xaml nested class path designer issue

Hi, I have nested class public class Enums { public enum WindowModeEnum { Edit, New } } In my xaml I reference code: <Style.Triggers> <DataTrigger Binding="{Binding WindowMode}" Value="{x:Static Types1:Enums+WindowModeEnum.Edit}"> <Setter Property="Visibility" Value="Collapsed" /> ...

Why does my GridSplitter not work at all?

I'm migrating a WinForms app to WPF. Everything has gone well so far except in relation to my attempts to use GridSplitter which I can never seam to make resize anything at run-time. To make sure it wasn't just my code I attempted to compile the GridSplitter sample from LearnWPF.com and it doesn't appear to work either. I am expecting t...

Can you set a gradient brush for a listboxitem background in silverlight?

I am looking for a way to set a gradientbrush as the background for a listbox item. I have a DataTemplate defined and have specified a gradient brush but it always appears as the listbox background (i.e. it never shows as a gradient brush). I have been able to set the background of the listbox itself, and I can set the listboxitem's ...

My ListView or ListBox control size doesn't shrink when there is a complex data template which hides display elements based on triggers?

I have a ListView element with a DataTemplate for each ListViewItem defined as follows. When run, the ListView's height is not collapsed onto the items in the view, which is undesirable behavior: <DataTemplate x:Key="LicenseItemTemplate"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <...

Load Child-Nodes on Expansion of Parent-Node in a TreeView via the IsExpanded Property

I know that there has already been some discussion about this, but I haven't been able to solve my problem yet. As for loading items on demand that works fine already. I have subclassed TreeViewItem, and whenever the 'Expanded' event is fired, my TreeViewItemSource fetches the next few Nodes. But this is a but messy, as I have the cust...

How can I vertically align the bullet in a XAML TreeView HierarchicalDataTemplate?

When a node in my TreeView has multiple lines, the TreeView bullet gets vertically centered. How can I top-align the TreeView bullet? <pages:BasePage.Resources> <data:HierarchicalDataTemplate x:Key="OutlineTemplate" ItemsSource="{Binding OutlineDocumentObjects}"> <TextBlock Text="{Binding Line}" TextW...

wpf Storyboard.SetTarget vs Storyboard.SetTargetName

Why does Storyboard.SetTargetName works but Storyboard.SetTarget does not? Here xaml - <Grid Grid.Row="0" ClipToBounds="True"> <X:SmartContentControl x:Name="smartContent" Content="{Binding Path=MainContent}" ContentChanging="smartContent_ContentChanging"> <X:SmartContentControl.RenderTransform> ...

Behaviors for Blend (Silverlight 4)

I'm wondering if anybody knows any good (free) behaviors for Blend/Silverlight 4 Specifically I'm looking for a behavior that I can drop on a TextBlock to make it scroll horizontally or a behavior that will "flash" text in a TextBlock (blinking text). But I'd love to hear about any behaviors you've been using or know about. As an examp...

WPF Window Top Won't Change.

Hi, I am using animations with my window to slide out or slide back up. But when these animations are not used. I would like to use Window.Top to set the position of the window, but I think due to animations I cannot set the top. I was wondering if anyone knows how to fix this? Thanks example. window.top is already = 33. but when is a...

putting multibinding on a single line in xaml

Is there a way to take this multibinding: <TextBox.IsEnabled> <MultiBinding Converter="{StaticResource LogicConverter}"> <Binding ElementName="prog0_used" Path="IsEnabled" /> <Binding ElementName="prog0_used" Path="IsChecked" /> </MultiBinding> </TextBox.IsEnabled> and put is all on one line, as in <TextBox IsE...

What are the Open Source alternatives to WPF/XAML?

If we've learned anything from HTML/CSS it's that, declarative languages (like XML) do a good job of describing User Interfaces because: It's easy to build code preprocessors that can template the code effectively. The code is in a well defined well structured (ideally) format so it's easy to parse. The technology to effectively parse ...

WPF: ContentPresenter changing Foreground unexpectedly depending on where styles are located

Hi, I'm having an issue with the ContentPresenter behaving unexpectedly based on whether the styles are located in the Window.Resources or in a ResourceDictionary. Specifically, I'm setting the Foreground of the default TextBlock to Black, then setting the Foreground value in my default button style to White. If the styles exits on the...