xaml

How do you bind menu items to a ContextMenu in silverlight, including the icon

I have a context menu and i want its menu items populated via a binding. The following code works <Button> <controlsInputToolkit:ContextMenuService.ContextMenu> <controlsInputToolkit:ContextMenu ItemsSource="{Binding MenuItems}"> <controlsInputToolkit:ContextMenu.ItemTemplate> <DataTemplate> ...

Command Binding not working when the host control is added programatically in wpf

This is weird. I have a UserControl (MyControl) with a button inside. I have added a command to this button whose command target is another user control which is again added to the same window. When I add the UserControl statically in xaml to the CustomControl's host space, the CommandBinding system works fine, where as the same doesn't...

Drawing a horizontal line in Silverlight

Possible Duplicate: Horizontal Rule in Silverlight/XAML Hi there, is there a way to draw a horizontal line in Silverlight? I'm thinking of a line to be used as a separator, much like the HTML element <hr />. Is there a quick and easy equivalent in Silverlight? Thanks very much! ...

ListBox.ItemsSource {Binding ...} doesn't work, but if I set the ItemsSource in code, it's all dandy!

Hello, I am experimenting with WPF and I came across a problem I can't seem to figure out although I have done some work with Silverlight previously and used DataContexts, Data Bindings and INPC successfully. This time I am stuck... I am using this code to create an instance of the application's main window: protected override void OnS...

Proper window design XAML (performance)

Hi all, I have made an application which showns a lists of client. You can open a client, and the client's details are shown. My application takes quite a long time to start, so I want to improve the startup performance. In pseude-code, my main window looks like this <Window> <c:WelcomeAnimation Visibility="Visible" /> <c:Cl...

WPF Two-way binding to a dataset - updating the database?

Okay, so I'm fairly new to WPF and data binding, but I've searched and searched and can't seem to find an answer to this. I have a database (called Inventory), and a dataset (called DevicesDataSet). What I'm trying to do is bind the dataset to a listbox, so that a specific device from the Devices table of the DevicesDataSet can be sele...

C# WPF Progress Bar ControlTemplate Update Text

I've create a control template for a progress bar that includes a textblock where I want to put the update the text based on the % of a file downloaded. I've no problem getting the % etc. I just want to know how from the c# code do I target the textblock. Here is my controltemplate <Style TargetType="{x:Type ProgressBar}"> <Setter...

How to Repeat x width silverlight header?

i try to write some codes : Header, Footer, Right, Left panel. But it must be like css Automatic width (if i maximize button in my explorer or firefox scanner). Such as default header width 300 if clicking max button of explorer it runs reat-x like css <UserControl x:Class="DockPanel3.MainPage" xmlns="http://schemas.microsoft.com/w...

WP7 help with menu effects

Kinda new to Silverlight and have some experience with WPF but I'm doing a project with a group for a class making a game for WP7. I am currently in charge of the menu system for the game and I had a few ideas for "flashy" menu transitions. I got some going for the main menu but I wanted to do something cool for the options submenu. Any...

Binding a progressbar to a mediaelement in wpf

In c#/wpf I added a progressbar and mediaelement to my window. The idea was that progressbar is displaying how much is been played in the mediaelement. I tried it with the following xaml: <Window x:Class="TestApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/...

How do I change WPF Menu's icon column size?

I have a WPF ContextMenu that looks like this: <ContextMenu Width="300"> <MenuItem Command="{Binding MainWindowViewModel.NewCommand}"> <MenuItem.Icon> <Image Source="pack://application:,,,/EAV.UI;component/Resources/Icons/MenuNew.png" Width="32" Height="32"/> </MenuItem.Icon> <MenuItem.HeaderTemplate>...

WPF: Bindings not working correctly

Say I have XAML like <TabControl Grid.Row="1" Grid.Column="2" ItemsSource="{Binding Tabs}" IsSynchronizedWithCurrentItem="True"> <TabControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding TabTitle}" /> </DataTemplate> </TabControl.ItemTemplate> <TabControl.ContentTemplate> <DataTem...

WPF semi cascading listbox

I have 3 controls on my page ListBox A ListBox B ComboBox C ListBox A is databound to a collection of items A ComboBox C is databound to a collection of items C ListBox B is databound to a collection of items B B has a reference to Item A and Item C, the ListBox B should only show the items where Item A is the selected item of Li...

Silverlight: Why is there space between these two elements?

I'm using Silverlight 4 to develop a Windows Phone app. I have a control defined by the following XAML: <Grid x:Name="LayoutRoot" Background="Transparent" Margin="0,0,0,20"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> ...

Silverlight 4 - How can I change button background color when focused with an Implicit button style?

I'm having a great deal of difficulty trying to achieve something that should be trivial. I'm using an Implicit Button Style defined in a global XAML resource file. I just want to change the background color of the focused button to red with a ColorAnimation. I've tried a number of different combinations in Storyboard.TargetProperty and ...

WPF Tree View select items when added to tree

I have a WPF TreeView which displays my ViewModel. I have a button that adds an item to a collection in the underlying ViewModel which adds a child node to the tree. This part works. What I want is the newly added item to be the SelectedItem of the tree view. I have read this already: How to programmatically select an item in a WPF T...

Problems loading images in a Silverlight ControlTemplate

I have problems accessing images in the ControlTemplate of a "Silverlight Templated Control" I implemented. The Style for my control called "ControlDragger" is the following: <!-- ControlDragger Menu button style --> <Style x:Key="MenuButtonStyle" TargetType="Button"> <Setter Property="Margin" Value="5,0" /> <Setter Property="Te...