xaml

Selecting a Textbox Item in a Listbox does not change the selected item of the listbox

I Have a wpf Listbox that display's a list of textboxes. When I click on the Textbox the Listbox selection does not change. I have to click next to the TextBox to select the listbox item. Is there some property I need to set for the Textbox to forward the click event to the Listbox? ...

In WPF, how can a dynamically loaded element access its parent's elements?

In Window1.xaml I have menu and display area: <Menu x:Name="TheMenu" Width="Auto" Height="25" DockPanel.Dock="Top"/> <ItemsControl x:Name="MainContent" DockPanel.Dock="Top"/> In Window1.xaml.cs I dynamically load in a menu item: MenuItem menuItemEmployees = new MenuItemEmployees(this); TheMenu.Items.Add(menuItemEmployees); In MenuI...

In WPF, is it possible to specify multiple routed events for a single event trigger?

I have an event trigger that I want to be fired in response to two different routed events. I don't want to repeat the event response code (in XAML) twice. Can I specify multiple routed events for a single event trigger declaration? Example of a single event: <Style.Triggers> <EventTrigger RoutedEvent="Button.MouseEnter"> ...

In WPF/XAML, should every container control contain a layout control?

When designing WPF application UI's in XAML, should every container-type control contain a layout control to house all children controls? Take a group box, for instance. I can either throw controls onto the group box directly, or I can use a layout control and place the layout control inside of the group box and then controls in that. ...

databinding tooltip in listbox

Hi, I am working with binding an xml structure to a listbox. I am quite confused hoe to do this.How to put a datatemplate inside a datatemplate or i need to use a hirarchialdatatemplate...for example from the xml, I want to display the Make Name of the cars in a list box and i want to show the corresponding Suvs's as a tooltip or context...

How do I set the size of a WPF window based on a desired client area size?

I know that in XAML/WPF, I can set the Window size using the Width and Height properties, but suppose I want to set the window size such that the client area (minus the Windows borders/decorations) will be a certain fixed size, what is the easiest way to do that? Like, suppose I want the client area of the window to be 640x480, ala this...

Declaratively set property of MyUserControl in MyUserControl.xaml

Assuming we have such control: public partial class MyUserControl : UserControl { public MyUserControl() { InitializeComponent(); } public string Foo { get; set; } } How can I set "Foo" property value declaratively in MyUserControl.xaml? <UserControl x:Class="Test.MyUserControl" xmlns="http://schemas.microsof...

OneWayToSource binding from readonly property in Xaml

I'm trying to bind to a Readonly property with OneWayToSource as mode, but it seems this cannot be done in XAML: <controls:FlagThingy IsModified="{Binding FlagIsModified, ElementName=container, Mode=OneWayToSource}" /> I get: The property 'FlagT...

Getting a column definition by name in wpf

For example: <Grid Name="TestGrid"> <Grid.ColumnDefinitions> <ColumnDefinition Name="TestColumnName" Width="*" /> </Grid.ColumnDefinitions> </Grid> I would like to be able to access the column definition in code using the name 'TestColumnName'. ...

How can I call a bound method in XAML with the parameter of a TabItem's name?

I've got an instance of an object bound in XAML. It's got a method that will return to me a list of other objects (based on the property value I pass this method, it will return all the objects with that property value). <ObjectDataProvider ObjectInstance="_this.DataContext" MethodName="GetListByCategory" x:Key="List"> <ObjectDa...

In WPF/XAML how do I change the size of a paragraph of text using a scroll bar?

I'm new to WPF/XAML & I'm just doing a training exercise at the moment. I've got a noddy application and I want to change the size of the text in a tag based on the position of a scroll bar. The text is defined by this code: <FlowDocumentScrollViewer Grid.Row="1"> <FlowDocument> <Paragraph> Text goes here ...

Bind to specified XML-element

In short: I want to define what XML ButtonSettings element to use for a XAML-Button, and to use the childs of the selected ButtonSettings-element in a style applied to that Button. Is this possible? A sample of the XML: <Buttons> <ButtonSettings ID="Bye"> <Text lang="NL">Doei!</Text> <Text lang="DE">Tsusch!</Text> <Tex...

Silverlight: Invalid Attribute Type for TargetType="{x:Type TextBlock}"

Just playing around with Silverlight a bit and trying to set a style to apply to all TextBlocks. The following XAML: <Style TargetType="{x:Type TextBlock}"> <Setter Property="Margin" Value="10, 10, 10, 10" /> </Style> Gives me the error Invalid attribute value {x:Type TextBlock} for property TargetType. I copied and pasted this bi...

WPF: XAML Custom Namespace

Okay so I have a Window in WPF. I add the following line inside of it: xmlns:controls="clr-namespace:mCubed.Controls" This compiles and runs just fine, but the Visual Studio designer gives me this error: Could not load file or assembly 'mCubed, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The ...

WPF: XAML Custom Namespace

Okay so I have a Window in WPF. I add the following line inside of it: xmlns:controls="clr-namespace:mCubed.Controls" This compiles and runs just fine, but the Visual Studio designer gives me this error: Could not load file or assembly 'mCubed, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The ...

Does WPF/Xaml have something like Flex/MXML's ViewStack

ViewStack in Flex/MXML is a container/panel control that holds multiple children but only makes one visible at a time, useful for implementing your own tab-style controls. Does WPF/Xaml have a class that works the same as this? I know it has its own dedicated tab control (what I'm trying to do isn't really a tab control, so not useful)...

c# find TreeViewItem to drop data

I want to drag data from a ListView and drop it in a TreeView(the draging works fine). I use DataBinding and ItemTemplate to fill the TreeView. <TreeView ItemsSource="{Binding Groups}" Name="tvGroups" AllowDrop="True" Drop="tvDrop" DragOver="tvDragOver"> <TreeView.ItemTemplate> <HierarchicalDataTe...

find parentitem in wpf-treeview

I hoped the answer to my previous question whould help me with this one, but it didn't. the initial situation is pretty much the same: <TreeView ItemsSource="{Binding Groups}" Name="tvGroups" AllowDrop="True"> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Participants}"> ...

Determine ListboxItem position in a canvas?

In my WPF Application I have a canvas with a Listbox in it. I want to overlay an Listboxitem with another control after it was clicked on the item. But for that I need the position of the Listboxitem in the canvas. I see the problem because the single Item is not child of the canvas. Only the Listbox itself is. Is there any way I can ge...

WPF problem: Need to draw a control on top of another.

Hi I've a shell window constructed of an Header, Main Content and Footer. The main content is a tab control. According to the design, one of the tab items content (a user control) needs to expand a little bit over the footer. At first I thought about implmenting this with a negative Margin, but the footer no matter what I did always get...