xaml

Problems with XAML WPF 4.0 Editor in VS2010

Wondering if anybody else has found some very odd behaviour with the XAML/WPF 4 editor in VS2010. This only occurs if the project is using .NET 4. Whenever I tried to open a XAML document for editing, the window would appear to open for a split second and then vanish, but VS2010 would still list the window as open. The fault was eventu...

Silverlight NavigationService Is Always Null

I read that a few people were having a problem with this so I wanted to post a (somewhat) elegant solution I came up with while trying to deal with this. The problem is when you create templated pages in Silverlight and the ContentControls do not have the parent Frame's NavigationService (it's always null when you try and use it). There ...

Am I stupid? How do I get to use XAML2009 features

I've been reading a little about teh new features available through XAML2009. How do I get to use them in VS2010 (.net 4.0)? Specifically, I want to use x:Arguments and want to know which namespace I need to include (if any). I've read this from the documentation (below), but I can't figure how to get round it? Should I just not use th...

How to set properties of a d:DesignInstance in XAML?

I'm using the new d:DesignInstance feature of the 4.0 series WPF tools. Works great! Only issue I'm having is: how can I set properties on the instance? Given something like this: <Grid d:DataContext="{d:DesignInstance plugin:SamplePendingChangesViewModel, IsDesignTimeCreatable=True}"/> How can I set properties on the viewmodel, asid...

iterating resourcedictionary xaml file

I am trying to display an amount of colorpicker controls depending on an amount of colors in a xaml resourcedictionary file. For some reason I can't figure out the right way to do this. When loading it in through a XAMLReader to a ResourcesDictionary Object, I m not sure what is the best way to iterate over it. I had first tried to han...

How do I conditionally format a WPF TextBlock?

I have a WPF TextBlock bound to a string. If that string is empty, I want the TextBlock to display a warning message in another colour. This is easy to do in code, I was wondering if there was a elegant WPF pure XAML solution for it? I have investigated Style Triggers, but the syntax doesn't come naturally to me. Thanks! ...

Why is button background defaulting to grey when IsPressed is true

Hey all, I have a simple problem. Using the IsPressed trigger i want to be able to set the background color of a button to something other than the default grey. Here is what the button looks like when it is not pressed and here is what it looks like when it is clicked Here is the trigger for the button. I know the trigger is firin...

wpf binding by selected value - swap out bound object without disturbing binding

Hi, I've got combo box bound to a custom collection type - its basically an overridden ObservableCollection which I've added a facility to update the underlying collection (via Unity). I don't want to confuse the issue too much, but thats the background. My xaml looks like this <ComboBox ItemsSource="{Binding Manufacturers}" DisplayM...

WPF: How to justify all lines within paragraphs (lines with line breaks too)

Hello, i have a some paragraphs within a FlowDocument, and what i need is to justify all lines (even lines with line breaks) Here's a code sample: <Paragraph TextAlignment="Justify"> "One of the most important operations necessary when text materials are prepared for printing or display is the task of dividing long paragraphs into in...

Assigning the Tag Property of a Control in WPF

If I have 7 checkBoxes, one for each day of the week, Can I assing in XAML the Tag property to each one of the the System.DayOfWeek enumeration value? <StackPanel > <StackPanel.Resources> <system:DayOfWeek x:Key="Monday" >Monday</system:DayOfWeek> </StackPanel.Resources> <CheckBox Name="chkMo" Tag="{StaticResource Monday}...

WPF: Show Panel on Right-click

I'm trying to have a WPF ViewBox 'appearing' at the cursor position in a user control when the user right-clicks on the control. Right now, I have the code: <!-- XAML --> <Viewbox Width="100" Visibility="Collapsed" x:Name="actionBox"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"> <Button>Item ▼</Button>...

WPF DataGrid duplicates new row when the newly added item is attached to the source collection.

<Page> <Page.Resources> <data:Quote x:Key="Quote"/> </Page.Resources> <tk:DataGrid DataContext="{Binding Quote}" ItemsSource="{Binding Rooms}"> <tk:DataGrid/> </Page> Code: Private Sub InitializingNewItem _ (sender As DataGrid, _ ByVal e As InitializingNewItemEventArgs) _ Handles...

How to get the Grid.Row Grid.Column from the selected added control?

How to get the Grid.Row Grid.Column from the added control? Basically I have 16 grids with 4 rows and 4 columns, each grid is added a round button. how to determine which rows and columns the selected round buttons are located respectively in the below MouseEventHandler of mouseover? For mouseclick, there is only round button selected...

Silverlight for windows embedded

Dear All This is my xaml file. <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication1.Page" Width="640" Height="480" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/mar...

iMX31 dependencies?

Dear all I am beginner in an silverlight application. So at first i looked on demo application which is provided by wince 6.0 r3 at location WINCE600\PUBLIC\COMMON\OAK\DEMOS\XAMLPERF - this contains c++ code and WINCE600\PUBLIC\COMMON\OAK\FILES\XAMLPERF - this contains xaml file with the images Now before running this applic...

Can't get focus on a TextBox inside a ListBox using Silverlight

I'm having a little trouble in silverlight with a databound ListBox containing databound TextBox elements. The items display correctly in the list and the TextBox is populated correctly but I can't get focus on the TextBox in the list. If I hover over the edges of the TextBox it highlights but it won't let me click into it to edit the te...

Can we manipulate (subtract) the value of a property while template bidning?

Hi, I am currently defining few grids as following: <Grid.RowDefinitions> <RowDefinition Height="{TemplateBinding Height-Height/5}"/> <RowDefinition Height="{TemplateBinding Height/15}"/> <RowDefinition Height="{TemplateBinding Height/20}"/> <RowDefinition Height="{TemplateBinding Height/6}"/> </Grid.RowDefinitions> While ...

Dependency Property Set Priority: CodeBehind vs. XAML

When I initialize a control property from code, the binding to the same property defined on XAML don't work. Why? For Example, I set control properties on startup with this statements: myControl.SetValue(UIElement.VisibilityProperty, DefaultProp.Visibility); myControl.SetValue(UIElement.IsEnabledProperty, DefaultProp.IsEnabled); and ...

Weird splitter behaviour when moving it

My demo app displays two rectangles which should fill whole browser's screen. There is a vertical splitter between them. This looks like a basic scenario but I have no idea how to implement this in xaml. I cannot force this to fill whole screen and when moving splitter then whole screen grows. Can anybody help? <UserControl xmlns:c...

Blend 4 Beta: How to change image source as part of Timeline

I'm trying out Blend 4 beta, and looking for a way to do a simple thing: When a mouse is hovered on an image, the image should change its source to a different image. When the MouseLeave happens, the image changes back. I know I can do it in source code, but I'm looking for a code free way to do it, without hand coding xaml. Blend...