wpf

Need to keep focus in a wpf content panel

Hi , I am switching content template of a ListViewItem at run mode to enable editting the item.For that i am showing a panel with Ok and Cancel options and i need the user to select any of those option before moving to anotheritem. Means i want that panel to behave like a modal dialog. Any suggestions ?. Advanced Thanks, Das ...

What is the easiest way to build a FrameworkElement that has bold and italic markup text?

Is there any more elegant way to do the following? Basically I need an easy way to programatically build a WrapPanel (or other FrameworkElement) that: wraps correctly allows some words to have bold text allows some words to have italic text allows other formatting, e.g. color, background ideal would be some method that converts e.g. "...

Ribbon-Like Control in WPF

I'm trying to create some drop-downs for a toolbar and want them to look like the Page Layout drop-downs in Word (such as the Orientation and Size menus). I've attempted to do this using a ComboBox, but I can't figure out how to show the option name, rather than the selected item at the top of the ComboBox. Is it possible to make the C...

WPF datagrid question

I have a WPF datagrid and it works great but I notice some sort of very tiny column before the first column ...I want to remove it ....How do I do it ? Take a look at the picture: http://i45.tinypic.com/2d177f9.jpg ...the thing I want to remove is what I surrounded in the red rectangle. ...

Is Josh Smith's implementation of the RelayCommand flawed?

Consider the reference article, specifically the example implementation of a RelayCommand (In Figure 3). (No need to read through the entire article for this question.) In general, I think the implementation is excellent, but I have a question about the delegation of CanExecuteChanged subscriptions to the CommandManager's RequerySugges...

RoutedUICommand PreviewExecuted Bug?

I'm building an application using the MVVM design pattern and I want to make use of the RoutedUICommands defined in the ApplicationCommands class. Since the CommandBindings property of a View (read UserControl) isn't a DependencyProperty we can't bind CommandBindings defined in a ViewModel to the View directly. I solved this by defining ...

WPF - Get the angle in degrees of a Vector3D as viewed from above

I'm working with a 3D that has a property of type Vector3D called FrontDirection. This object is rotated as follows: var rotate = new AxisAngleRotation3D(new Vector3D(0, 1, 0), deltaAngleInDegrees); var transform = new RotateTransform3D(rotate); my3DObject.FrontDirection = transform.Transform(my3DObject.FrontDirection); After some a...

Using Windows Explorer context menus within WPF

Hello All, Is there a way to gain access to the Windows Explorer shell context menus for files & folders without using a complete Explorer drop-in control? The gist of my plight is this: I have a Viewport3D that displays a handful of raw files & folders. Basically, it's like every other 3d explorer replacement you've ever seen :) W...

How can I bind a ListBox's items to a List of instance objects?

My code behind file receives an instance object Session which has a property AvailableCountries that returns a List. Each Country object has a Name property which is a String. I also want to display these Country objects using a data template which I simplified here. My current code is after going through a WPF binding tutorial, only t...

How do I make a reflection effect in WPF ? (from code)

hi guys, I need to have some mirror objects in WPF. I have a Canvas with some content, and I need 50 visual clones, and if I modify something on the source, it should be updated in these clones. I know it is easy to do in XAML by binding the Visual of a VisualBrush to the element, but can's seem to do this from code. Can anyone help ...

WPF ListView Selecting Multiple List View Items

Hi, I am figuring out a way to Select Multiple items in list view and deleting them on a certain action. What i can't figure out is, how should I have these multiple items selected? I would think there is a list that i would need to add them all into, but what's the best way to approach this situation, do you have any ideas? Thanks! -Ke...

How to rollback changes made to a object in silverlight 3 with a TwoWay binding

I have a Silverlight 3 project. I have a textbox that is TwoWay data bound to an object. If the user wants to cancel the changes that they made to the textbox, what is the best way to undo the changes to the bound field on the object? I know I could store the initial value in a separte variable when the object is loaded, but I was won...

WPF TextBlock font resize to fill available space in a Grid

I have some text that is displayed at run time in a textblock. I want the font size to be the biggest it can be to fill the area that is given. I think I have the textblock setup correctly to "autosize" and I try to increase the font size till the textblock is bigger than than its parent then decrease the font size by 1. The problem is I...

Delay rendering of a custom control in WPF

I have a WPF custom control that sometimes takes a while to render in some complex scenarios. I would like to be able to tell my custom control to show a placeholder image (e.g. "Please wait - rendering!") and then actually render the control in idle time (after input is processed). I am thinking along the lines of having my custom cont...

How can I set the focus to a ListBox properly on load if it uses databinding?

I usually call myControl.Focus() in the Loaded event handler, but this doesn't seem to work for a ListBox which is databound to a list of custom objects. When I start my application, the ListBox's first item is selected but the focus is elsewhere. I thought this could be because the focus is being set before the databound items are load...

WPF window class destruction

I create a window like this: if (someCondition) { MyWindow wnd = new MyWindow(); wnd.Owner = this; wnd.ShowDialog(); } I want MyWindow's destructor to be called at the closing curly bracket, but it doesn't. Do I need to call something like delete/destroy for MyWindow's destructor to be called? ...

Display an Adorner over a WebBrowser control

I'm using the System.Windows.Controls.WebBrowser for various things in my app and I've noticed that adorners are cut off when they are supposed to appear over a WebBrowser. I realize that the WebBrowser control is really a wrapper around a COM component and probably renders differently, but I wondered if anyone figured out how to solve ...

Prism: Looking for ideas of how to design apps that don't necessarily comply to a standard region layout

I have an app that has several modules that have completely different functionality and I'm trying to figure out the best way to implement this using prism. To try and better explain, I'll try to use Northwind as an example. I have 3 modules, orders, customers & employees. The customer module will allow you to do anything pertaining t...

Is there a good way to convert between BitmapSource and Bitmap?

As far as I can tell the only way to convert from BitmapSource to Bitmap is through unsafe code... Like this (from Lesters WPF blog): myBitmapSource.CopyPixels(bits, stride, 0); unsafe { fixed (byte* pBits = bits) { IntPtr ptr = new IntPtr(pBits); System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap( width,...

WPF XAML - Could not create an instance of type 'GlyphTypeface'. at design time.

I'm trying to visualize a XAML resource file at design time. When I merge the dictionary for the following XAML resource file into a XAML Window I get the error: Could not create an instance of type 'GlyphTypeface'. The problem line is: <GlyphTypeface FontUri="C:\WINDOWS\Fonts\TAHOMA.TTF" /> I have verified that the font exist in the...