wpf

TreeViewItem not showing its expander control

I have the following XAML: <TreeView> <TreeViewItem ItemsSource={Binding} Header="TopMost" IsExpanded="True"> <TreeViewItem.ItemTemplate> <DataTemplate> <TreeViewItem> <TreeViewItem.Header> <TextBlock Text="{Binding SubTopic}"/> <TreeViewItem.Header> ...

WPF Update Control In Place Using XAMLReader

I have an existing item which is a child of a canvas. The item's style is contained in a resource dictionary that contains the various brushes that can be used to color the item. When an instance of the item is created it is given the default coloring. I am currently not able to directly interact with the Fill property as in: item.Fi...

Incorrect item gets selected when starting a drag on an item in an ItemsControl

I am implementing a DragDrop framework for WPF (which incidentally you can find here). I have a problem in that when the user MouseDowns on an ItemsControl we don't know immediately if they intended to click the item to select it, or to begin a drag. If the user clicks an item and then quickly moves the cursor, another item other than t...

How Can I Animate Mouse Over Event Using WPF Triggers For a Tab Item?

I have overriden tabitem template and created my own custom style. however, I'm not sure how to write event triggers for mouse over event. ...

Why are ActualWidth and ActualHeight 0.0 in this case?

I have a Grid inside a Canvas defined like this: <Canvas x:Name="outerCanvas"> <Grid Grid.Row="1" Name="cGrid" ShowGridLines="True" Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType={x:Type Canvas}}}" Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource AncestorType={x:Type Canvas}}}"> ...

Strict vs handy syntax for some properties' values in XAML.

Hi there. There are a bunch of properties to which you could provide a value in several ways. For example: Style.TargetType: "ns:TypeName" vs "{x:Type ns:TypeName}" Button.Command: "ns:TypeName.StaticPropertyName" vs "{x:Static ns:TypeName.StaticPropertyName}" You name it. The question is: are there any drawbacks which comes along w...

Logging when application is running as XBAP?

Anybody here has actually implemented any logging strategy when application is running as XBAP ? Any suggestion (as code) as to how to implement a simple strategy base on your experience. My app in desktop mode actually logs to a log file (rolling log) using integrated asop log4net implementation but in xbap I can't log cause it stores ...

How can I make rectangle strech across entire grid?

Hi, I'm building a small WPF application. For the layout in the application, i use a grid with two columns and two rows. I want to have a background rectangle that fills the entire application, and I want the background rectangle to strech so if a user resizes the window, the rectangle streches and always fills the entire window. So ins...

WPF 3D Billboards

In a 3D scene we often need to apply labels (little textelements or icons) next to 3D object that is moving around (rotation, translation) in the scene. These labels should always face the camera but still move with the object. This technique I believe is called billboard. An additional cool feature would be if the label would stay al...

WPF rectangle - round just top corners

How can I have just the top corners rounded for a WPF rectange? I created a border and set the CornerRadius property and inside the border I've added my rectangle, but it doesn't work, the rectangle is not rounded. <Border BorderThickness="1" Grid.Row="0" Grid.ColumnSpan="2" CornerRadius="50,50,0,0" BorderBrush="Black"> <Rectangle Fill...

Data-bound UserControl in ListBox.ItemTemplate

I have a simple class Product and a UserControl named ProductSummaryControl. ProductSummaryControl displays the details for a Product class that is passed in to its DataContext. I have verified that this works when I set up the control and its property manually. I run into a problem when I try to use the ProductSummaryControl as part ...

How to interact with other application forms

I am looking for a way to once I see a form by Name add a button to that form and when the user clicks the added button, pull information from the form. For example, if I see the for title - "Stack Overflow - Wnidows Internet Explorer" I would add a button "MyButton" on the form, and when that button is clicked, I would "pull" the infor...

WPF Treeview ShowRootlines

Hi, Is there a way to show Root lines in a WPF Treeview? Or do you have to resort to doing something complicated like using Control Templates The Winforms treeview has a ShowRootLines property but none exists for the WPF treeview. Thanks ...

WPF Threading question better option.

Hi Here are the 2 ways we are using trying to use thread/dispatcher for multi tasking a few things: I am wondering if anyone has any suggestions which one is better option. Snippet 1: Thread t = new Thread(new ThreadStart(delegate { MyMethod(); })); t.IsBackground = true; t.Start(); t....

xaml code works fine but code behind class's code doesn't work :(

Hi guys, This is my xaml code <Canvas.RenderTransform> <TransformGroup> <ScaleTransform ScaleY="-1" /> <TranslateTransform Y="300" /> </TransformGroup> </Canvas.RenderTransform> I did the same thing in code behind class but the code doesn't give the expected result. Can someone please help me to convert this ...

Pattern to implement a toolbox in .Net/Wpf (not the visual part)?

I'm building a Wpf app that currently has a toolbox which looks and functions similarly to the Visual Studio toolbox. I have a range of classes that are represented in the toolbox and different types of objects that can each contain some, but not all, of the toolbox items. As a stopgap measure to get my app up and going, I hardcoded the...

WPF ComboBox DropDown arrow color

Hello I am trying to work out a style for a combo box that has a navy background with white text, so I want the drop down arrow to be white also (the xaml I have so far is below). How can I do that? Cheers, Berryl <Style x:Key="ComboBoxStyle" TargetType="ComboBox"> <Setter Property="Background" Value="{StaticResource header...

need to add textBlocks to a group box and clear when data is loaded in a graph control

hi guys, I'm creating a graph control. what i'm doing for adding x and y axis tally labels is i'm adding a text block to each tally mark and show the value related to that tally mark. but when i need to load data form the database and redraw the textbolcks again and refresh the graph area i can't remove the older textblocks they are s...

"The calling thread must be STA, because many UI components require this." Error in WPF ?

Hi, I am creating a xps document as below. Assembly assembly = Assembly.GetExecutingAssembly(); //read embedded xpsDocument file Stream helpStream = assembly.GetManifestResourceStream(resourceNameOfContext); if (helpStream != null) { Package package = Package.Open(helpStream); string inMemoryPackageName = "memorystream://" + to...

WPF Printing issue

Hi all, I have to do printing of visuals say Grid contents, over multiple pages supporting basic printing functionalities like changing the margin, orientation ,paper size etc without invoking Print Dialog. 1. So should I use Custom Printing or Will Print document serve my purpose? 2. If Print document allows these features, please l...