xaml

Binding to Children.Count

Hi, I'm using a binding of the form {Binding RelativeSource={RelativeSource Self}, Path=Children.Count, Converter={StaticResource CountToDimensionConverter}, ConverterParameter=Rows} Despite adding the children in xaml, when I break in the converter, the value is always 0. What I assume is going on is that the children are not adde...

What's the cause of the "Stack empty" XamlParseException when trying to kick off an animation in the OnInitialized handler?

I'm just playing around with WPF at the moment and I don't entirely understand how it works, but this is baffling. I have a piece of code which creates a TextBlock with a RenderTransform and animates it scrolling across the screen. This is pretty much a procedural translation of something Josh Smith wrote to demonstrate how you might do ...

how to bind to control inside expanders' contentemplate

I have a textbox inside a Expasnders contentemplate that I'm trying to bind to from outside the expander, but it's not really possible, I have another textbox inside the expander looking like this: and an exact duplicate of this markup outside the expander, The textbox inside the expander updates it's text proeprty when txtTitle is ch...

Is it possible to use RadMaskedTextBox inside an AutoCompleteBox in Silverlight / Expression Blend?

It's probably doable, but with my n00b skills I couldn't figure this out yet. When I try to "Make Into Part" on the RadMaskedTextBox, Expression Blend complains that it's not a TextBox. How can I make it to use it as a proper control part? Can I "typecast" somehow in XAML? Thanks in advance for all help! ...

WPF CornerRadius turn the Corners to the outside

Im trying to make my own ControlTemplate for an menu. Id like to turn the corners of some items to the outside. So that it look like the Word TabItems, i cant post an image im sry. But i hope you understand what i mean. Is there a possibility to change the cornerradius like that? or are there other possibilitys? regards Mark ...

FlowDocumentScrollViewer woes

My goal is to have exandable sections in a flow document. This XAML works, BUT 1- if you change the root from grid to stackpanel the scrollbar no longer works. 2 - Exand section 1. Scrolldown and you'll see the Toolbar at the bottom and Section 2 below that - even tho IsToolBarVisible="False". Perhaps I need to structure the FlowDocum...

GeometryModel3D Area and Volume

Is there a way to calculate the Area and Volume for a given GeometryModel3D? ...

Event Bubbling click event in WPF Xaml.

I know that events in WPF bubble up the visual tree, so I don't understand why this simple example of catching the event of a context menuitem click event on it's parent listbox doesn't work: <ListBox Width="200" MenuItem.Click="MenuItem_Click"> <ListBoxItem> <TextBlock Text="Hello"> <TextBlock.ContextMenu> ...

How to implement commanding in silverlight

Simple case: <usercontrol> <Views:UserListView x:Name="settingsTreeView"/> <Button DataContext="{Binding ElementName=settingsTreeView, Path=SelectedItem}" Command="{Binding CreateChildCommand}"/> </usercontrol> The task just is to bind to button a DataContext which implements CreateChildCommand. DataContext is the sel...

ItemsControl with static header

Hi I think I have a pretty simple goal but cant seem to reach it. All I want to achieve is to have a ItemsControl (because I don't want the selection functionality of a list) with a header. Preferably a static header. Currently I'm using a grid for the header and then copying that grid into the ItemTemplate (DataTemple) of the ItemsCo...

Exapand wpf menu depending on situation

How can I customize the menu to the situation in WPF? I have a main window with a basic menu. In this window, I can load different UserControls and then I want the menu to be expanded with different menu options depending on which User Control is used. In addition, I wonder how I add a MRU. Example: Main menu: File Open - MR...

WPF bind property to Dependency Property in child control

Ive created a custom UserControl that contains a single combobox. The currently selected value in the combobox is bound to the custom UserControls Dependency Property. XAML: <UserControl> <ComboBox ItemsSource="{Binding AllEntries}" SelectedItem="{Binding SelectedEntry}" /> </UserControl> Code behind: public part...

Using Events/Commands with XamlReader

I am dynamically building my datatemplate using XamlReader.Parse(string). The problem I have is that I can't put any events on any of the controls I create using the XamlReader. After doing some research online I've learned that this is a known limitation of XamlReader. I don't know a lot about commands in WPF but could I somehow use t...

WPF, 'Object reference not set to an instance of an object' in Designer

I'm getting an "Object reference not set to an instance of an object" error when I try to reload the Designer for my XAML UserControl. Visual Studio highlights the following line as being the problem: <local:TemplateDetail Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Width="600" TemplateData="{Binding ElementName=cbo_templates,...

Localize images in WPF

Hi. I'm building a program in WPF which must feature multi-language support, with the ability to switch language at run-time. My question concerns the image part of the localization. I've built a solution which does not work the way I had hoped it would work and I would like some help fixing these problems. The code posted below is onl...

Generic.xaml - Referencing styles

If I have a Style inside Generic.xaml and I want to reference a style within the SAME Generic.xaml file why does it not work? <Style TargetType="{x:Type w:SomeControlIWantToStyle}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type w:SomeControlIWantToStyle}"> ...

From Web Developer (HTML/CSS) to WPF: How can i start styling my WPF app?

i know HTML/CSS and want to learn WPF styling. how can i get started. i see that padding, for example, works differently in WPF app. in css: padding: 5px 10px; in XAML? Padding="5px" i notice that i need to expand the width of the element eg. button myself to accomodate the padding? if so, how can i calculate the box model? the...

WPF StaticResource works, DynamicResource doesn't

Hi, I have been trying for a day now, to no avail, to create a bunch of brushes in the theme then using them with DynamicResource in a custom control. What I did is this: create the theme generic.xaml which contains styles (works) add a dictionary to merge in generic.xaml to contain brushes used in the application (works) make brushes ...

WPF Data Binding

when do i use each of the following? {Binding ElementName=...} {Binding Source=...} {Binding ... Path=...} <TextBox DisplayMemberPath=...} // and i think i saw something like ... {Binding xxx} i also wonder if there are any other ways of data binding i need to be aware of? i am new to C#/WPF ...

Impossible to select multiple items from the listbox in a windows phone 7 application.

How can I select multiple items from the listbox in a windows phone 7 application? e.g listboxName.SelectedIndex = 0; listboxName.SelectedIndex = 1; listboxName.SelectedIndex = 2; The above code selects 2 while I need to select all three of those. The values I need to preselect are given to me in a array like {true,true,true,false,fa...