xaml

Strange WPF Xaml behaviour - XAML grid element remaining null in Window_Load

I have a grid in a XAML file in a WPF project. This MainGrid contains 3 columns into which I have placed another 3 grids. If I arrange the MainGrid children in order 0,1,2 in the XAML e.g. <Grid Grid.Column="0" Name="grid0"></Grid> <Grid Grid.Column="1" Name="grid1"></Grid> <Grid Grid.Column ="2" Name="grid2"></Grid> then the grid2 r...

Convert SWF to Xaml

Are there any products out there that convert Flash SWFs to Xaml (I'm interested in WPF but Silverlight could work too)? ...

Databind radiobutton group to property

Hello, I have a radiobutton group: <TextBlock Height="24" Text="Update Interval (min):"/> <RadioButton x:Name="radioButtonTimerNone" IsChecked="{Binding UpdateInterval, Converter={StaticResource updateIntervalToCheckedConverter}, Mode=TwoWay}"} Content="None" /> <RadioButton x:Name="radioButtonTimerOne" IsChecked="{Binding UpdateInterva...

My.Resources in WPF XAML?

Hello! Is there a way to access My.Resources thru Xaml? Like this <Image Source="{Binding MyImage, Source={x:Static my:Resources}, Converter={StaticResource MyBitmapToImageSourceConverter}}" /> This is the error I get: \Application.xaml(122,36): error MC3029: 'my:Resources' member is not valid because it does not have a qual...

Binding to indexed property with String key

Say I wanna bind to dictionary that TKey is string with XAML: <Label DataContext="{MyDictionary}" Content="{Binding Item("OK")}" /> Doesn't work. How should I do it? I am talking about the Item("Key") ...

How can I toggle a TextBlock's visibility in a DataTrigger?

This code works (when ControlType="dropDown" then the background yellow): <Window x:Class="TestCollapsed.Views.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c="clr-namespace:TestCollapsed.Commands" Title="Main Window" Height="400" ...

Disable Drop & Drop In WPF GridView Column Headers

Does anyone know how to do this? I am really surprised at the scarce documentation/sample code for the WPF GridView (ListView View=GridView). ...

Why XAML is compiled into BAML and not in C#

As far as I know, everything done in XAML can be done in C#. Why XAML is compiled in BAML and not in C# ? Wouldn't be more efficient to parse the XAML a compile-time and create the corresponding C# code ? ...

How do I use the DataType property on a WPF DataTemplate?

So obviously I am doing something wrong, but I just cannot seem to get the HierarchicalDataTemplate (or even just DataTemplate) to work when using the DataType property. I have created the shortest possible WPF application to demonstrate the problem. XAML: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.c...

How to implement a XAML Radio Button control with an ObservableCollection source?

I have the following ComboBox element in XAML: <ComboBox ItemsSource="{Binding CollectionControlValues}" SelectedItem="{Binding CollectionControlSelectedValue, UpdateSourceTrigger=PropertyChanged}"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Value}" /> </DataTemplate> </Combo...

Three-column design: one static header, one side-bar with v-scroll, one center-box with v/h-scroll

How would you code this design: Update: Here's where I'm at: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" MinWidth="200" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <!-- v-scroll on contents --> <StackPanel x:Name="sidebar" Grid.Column="0"> <StackPanel x:Name...

WPF Portlet like Layout Control

I'd like to design a custom control which can be used as a container like other Layout controls. I want this control to have a dependency property named Header which can display header for this control. Basic intention is to imitate looks of portlet control available in Sharepoint etc. with configurable headers. Any links, suggestions, ...

XAML Setter Property to Command

I am trying to call a command when my mouse is over a toggle button. I have the following code. <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Cursor" Value="Hand"></Setter> <Setter Property="Command" Value="{Binding Path=PushPinMouse}" /> </Trigger> When I roll the mouse over, the hand shows. But when i roll the mo...

Xaml Binding to Commands

I am trying to call a command when my mouse is over a toggle button. I have the following code. <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Cursor" Value="Hand"></Setter> <Setter Property="Command" Value="{Binding Path=PushPinMouse}" /> </Trigger> When I roll the mouse over, the hand shows. But when i roll the mou...

WPF Mouse Over

What is the best way to link a method when the mouse over event is fired? An example. when a mouse hovers over a button. A method fires such as count. So as long as the mouse is over the button, the count will keep on incrementing. How will i connect a mouse over event to a method? Using Xaml?! ANY IDEAS?! ...

WPF: Making the Target property refer to a control in WindowsFormsHost

In WPF, you can assign a label a mnemonic, and tell it which control to activate with the "Target" property. This doesn't work if the target is a WindowsFormsHost. Is there a known solution to this? Here's an example. I am trying to make ALT-S activate the masked text box. <Label Width="Auto" Target="{Binding ElementName=tbSta...

Bind Shape properties and attached properties to properties

I have a property: public double S { get; set; } and XAML: <Canvas Name="MainCanvas"> <Ellipse Canvas.Left="10" Canvas.Top="10" Height="10" Name="ellipse1" Stroke="Black" Width="10"/> </Canvas> How can I bind both Ellipse Width and Height properties and attached Canvas.Left and Top properties so that I can set values to be diff...

How do you validate a clr property after it has been updated instead of before when implementing IDataErrorInfo?

I have implemented IDataErrorInfo in one of my classes to validate a property of that class. The property is bound to a control on my wpf user control. The validataion works fine, except there is one vital flaw. It seems to be calling the IDataErrorInfo member public string this[string columnName] before the property is updated, so ...

Why would adding an assembly in a XAML file give an error?

I've got an application that reads in XAML files dynamically like this: StreamReader sr = new StreamReader(pathAndFileName); this.Content = XamlReader.Load(sr.BaseStream); In one of those XAML files that gets loaded in (they all have had their code behind removed), this works: <UserControl xmlns="http://schemas.microsoft.com/winf...

WPF DataBinding to property in control

I Have A wpf UserControl with a property: private IEnumerable<PropertyBase> properties; public IEnumerable<PropertyBase> Properties { get {return properties;} set { properties = from property in value orderby property.Position select property; } } I want to create a ListBox that is bound to my Properties property with Pr...