wpf

ScrollViewer in a ListBox not working. WPF.

Hi, I have the following defined in my control: <Style TargetType="primitives:CalendarDayButton" x:Key="EventCalendarDayButton"> <Setter Property="Background" Value="#FFBADDE9"/> <Setter Property="MinWidth" Value="5"/> <Setter Property="MinHeight" Value="5"/> <Setter Property="FontSize"> <Sett...

Where should I set the DataContext - code behind or xaml?

(honestly I searched and read all the 'related questions' that seemed relevant - i do hope i didn't "miss" this question from elsewhere but here goes...) There are two different ways (at least) to set the DataContext. One can use XAML or one can use the code behind. What is the 'best practice' and why? I tend to favor setting it in X...

Dragging Controls on Form at runtime

Hi All I've just started using WPF. But I'm trying to add my code that (from Winforms) enables the user to drag any control whereever they wish at runtime. But I can't seem to get the current Location of the mouse... Eh? There is no Location for Mouse? :( ...

WPF ShowDialog returns immediately

Sometimes when I call ShowDialog on an OpenFileDialog Window in WPF, the dialog closes immediately with a return value of false. I'm calling ShowDialog in response to a button click event. I can reproduce this problem using the sample code for OpenFileDialog on MSDN: // Configure open file dialog box Microsoft.Win32.OpenFileDialog dlg...

ListView View mode as GridView with no bindingd

Hi, When you use a GridView as a ListViews view mode, you have entered yourself into a world of column-wise binding....is there a way for this not happen, or a work around that provides the listview with column headers but allows row-wise binding? Thanks, U. ...

WPF TabControl & TabItems with DropShadows

Hi Guys, I'm looking for a way to control DropShadow (DS) effects on the TabControl and TabItems in Blend 3. I want a DS effect on the selected TabItem and TabControl and then a different DS effect on the unselected TabItems. There is an image here to show what I mean: http://www.funkadeelia.com/imageHosting/TabControl_example.jpg Ba...

Migrate style from TabItem to TabHeader

Good day! I have a TabControl with TabItems that have been customized via a control template. This control template specifies a trigger whereby on mouseover, the content of tab header grows slightly. <ControlTemplate> <Storyboard x:Key="TabHeaderGrow"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.Target...

WPF Validation of clipboard Data

Hello normal validation is always related to some control, but in my case there is no control to fire validation when its content changes and to show errortemplate to the user. because the data to be validated is in the cipboard. when the user presses "PASTE" button viewmodel processes the data and finds it to be invalid. but what is th...

Having hard time binding array of object from web service call to wpf listbox

Hello guys! i started a WPF application (with vs 2008 sp1) which connects to a web service to get Collection of objects. I can be contactInfo[] or groupInfo[]. here is my main.xaml.cs public main() { InitializeComponent(); //service.addContactCompleted +=new addContactCompletedEventHandler(addContactCompleted); ...

Get notified of DataContext changed in a WPF Resource

Hi all: I'm having an annoying problem with WPF binding. Basically, I declare a FrameworkElement in my UserControl's resources, but that item doesn't seem to get notified when the DataContext of the parent UserControl changes. Basically, in my UserControl I have a Popup in the ItemTemplate for an ItemsControl. In that Popup, I needed...

Drag and Drop from Silverlight to WPF

Hey guys, I'm wondering if anyone has been able to Drag some item (let's say an image with an id) in silverlight and drop it in a listbox in WPF. If you have please help ;) Thanks, S ...

Assigning a float to a decimal property via a style setter in WPF

I have the following xaml in a template for a lookless control: <Style x:Key="NumericUpDownStyle" TargetType="controls:NumericUpDown"> <Style.Setters> <Setter Property="Change" Value="{x:Static local:Preferences.ChangeAmount}"/> </Style.Setters> </Style> Where the 'Change' property on the 'NumericUpDown' control is a d...

Programmatically Add Controls to WPF Form

I am trying to add controls to a UserControl dynamically (programatically). I get a generic List of objects from my Business Layer (retrieved from the database), and for each object, I want to add a Label, and a TextBox to the WPF UserControl and set the Position and widths to make look nice, and hopefully take advantage of the WPF Vali...

Capturing WPF Vector Information BEFORE it Renders to Screen

I'm trying to "capture" or record the vector display information of a WPF (maybe Silverlight) application and play it back. However, instead of capturing bitmaps of what is rendered, I would like to capture the vector information BEFORE it gets rendered so that I can play it back at different resolutions without loss of quality. Ideall...

WPF button template alignment not setting correctly

Hi guys, I have created a button template consisting of a border and a content presenter. A style is then wrapped around this template and applied to a button, when this button is used it is not carrying the values for horizontal and vertical alignment. In the designer the allignments are showing and the button is in the correct place, b...

WPF 4, ListView and ListCollectionView custom sorting

I'm trying to use a custom sort with a ListView, as described in this blog entry. I'm doing ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(TheList.ItemsSource); as recommended there and in several other places, but for some reason I'm getting "Unable to cast object of type 'MS.Internal.Data.Enumerab...

When will the ValueConverter's Convert method be called in wpf

I have an ObservableCollection bound to a list box and a boolean property bound to a button. I then defined two converters, one that operates on the collection and the other operates on the boolean property. Whenever I modify the boolean property, the converter's Convert method is called, where as the same is not called if I modify the o...

Trouble with creating WPF window extended on the title area (like Office 2007/2010)

I want to make WPF window extended on the title area (like Office 2007/2010). I implemented DwmWindow (see DwmTest.zip) where I put required stuff. Commonly, it works fine except one disgusting thing: the window appears as white rectangle (see DwmIssue.png) and after a few second this rectangle disappears and the content of the window is...

Get control in code from ControlTemplate By Name

Hello. I have next control template in my WPF app. <Style TargetType="Label" x:Key="LabelStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Label"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinitio...

Is it possible to do PlaneProjection(Silverlight) in WPF ?

Is it possible to do PlaneProjection(Silverlight) in WPF ? ...