wpf

Adding a dynamically changing control in XAML?

I have a class called Loader and inside Loader I have: public class Loader { public static UIElement Background { get; private set; } // ... public void LoadFile(FileInfo file) { // ... } } What this class does, is load a file, either a XAML, MP4, WMV, JPG, or PNG file. The LoadFile() function will take t...

XAML projects (Silverlight / WPF) Images or converted XAML Paths

My teammates and I are discussing the relative merits of converting icons our project uses into XAML. Blend has an "import" option that we can use to convert some of the image resources in the project to XAML Path elements automatically. On the one hand by producing XAML the assembly will remain small. On the other hand there is a simp...

Binding A Value in Header WP7/Silverlight

Noob question. :) I'm trying to add Margin to a Header through out my app and dont want to have to manually add that in all my views and I'll need to have various HeaderText. I know i need to add this to the App.xaml and i can get the Margin applied but I can't seem to get the Text to Bind. My Header Looks like this currently: ...

Having trouble getting contents of ListBox to resize with it

I tried the suggestion here regarding Stretching, but it didn't work for me. I have a TabItem that hosts a UserControl that is essentially just a ListBox with an ItemsPanel. The ItemsPanel forces the ListBox to display its contents horizontally. The contents of the ListBox are databound to an ObservableCollection<StackPanelContents>, ...

MVVM Light EventToCommand Not Working with CaptureMouse

Hello all. I'm having some trouble with the EventToCommand not behaving as I would expect with CaptureMouse. I have a ResizeGrip that I've defined several EventToCommand's on: <ResizeGrip Name="ResizeGrip" HorizontalAlignment="Right" VerticalAlignment="Bottom" Cursor="SizeNWSE"> <i:Interaction.Triggers> <i:EventTrigger EventName="Mo...

How to fire a Command when a window is loaded in wpf

Is it possible to fire a command to notify the window is loaded. Also, I'm not using any MVVM frameworks (Frameworks in the sense, Caliburn, Onxy, MVVM Toolkit etc.,) ...

How to add a UserControl to a Window in BlendDesigner?

Hello, I am a beginner in using Blend and WPF in general. I created three user controls. I also created a Window which should house the user controls. Is there any designer way, like drag dropping the user control into the Window which will make it appear automatically?. Or typing in the XAML is the only way to include it? ...

Cannot find System.Xaml?

I have a VS2010 project that needs a reference to System.Xaml. I go to the Add Reference, search the .NET references and it's not there. :? I double checked the GAC too, and no such luck. I just can't figure out for the life of me why it's not on the machine. This machine has .NET 3.5 SP1 and .NET 4.0 installed. I'd much rather th...

How Bind Image and text in a datagridview column?

Hello Everyone For my application I need to put Icon and Text in the same datagridview column. Please help me. ...

Replace RichTextBox's ContextMenu

Using .NET 4 and VS2010 Pro, I've created a very simple WPF Application that contains the following XAML in the MainWindow: <Grid> <RichTextBox x:Name="richTextBox" Margin="2"/> </Grid> All I would like to do, and have so far been unsuccessful at doing, is to replace the ContextMenu for the RichTextBox with my ow...

How to capture the focus of a TextBox inside a ListView grid.

This code generates a Listview with a grid, of multiple name and emails inside TextBox control. I would like to know how can I capture the focus event on one of the TextBox of a row to have the entire ListView row to be selected. <ListView Name="lstRecipients" ItemsSource="{Binding Path=Recipients}"> <ListView.Resources> <Da...

accessing a visual element in code

I would like to do the equivalent of the following xaml in code, but I don't know how to grab that text block element: <local:DayOfTheWeekColumn ... <local:DayOfTheWeekColumn.Header> <TextBlock Text="{Binding ...}, ToolTip="{Binding ...} /> </local:DayOfThe...

How to create a control and manage its events in one method?

I'm still stuck. Assume that I've got a user control with a button. And an event called damnIt_ButtonClicked. In the main window I want to emulate the control's lifetime like it is a modal dialog, although it's not. I want to wrap everything into one method, it returns true if the Button on the control clicked. public bool Show() {...

Show a grabber in a WPF StatusBar?

In WPF, how do I display a grabber (the mall dotted triangle in the lower right corner) in a StatusBar control? Thanks. ...

How is it possible to stuff a Grid inside a TextBlock?

The other day I ran into the following xaml and I freaked out: <Grid x:Name="LayoutRoot"> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid> <Rectangle Fill="AliceBlue" Width="25" Height="25"/> </Grid> </TextBlock> </Grid> In other words ... how is it possible to put a Grid i...

How do SystemColors work?

If I write test = Application.Current.FindResource(SystemColors.ActiveBorderBrushKey); test will have a value even though Application.Current.Resources is empty. How does it work? ...

WPF Window.Measure not setting the DesiredSize

I am trying to setup a printable view of my WPF window and I'm having a very hard time getting the content to size properly (surprise!). Specifically, Measure doesn't seem to be setting the DesiredSize property of my window. The basic approach I'm trying to take is that I've created a separate Window object (PrintView) that contains ...

[WPF] How to draw a simple volume bar fast / databinding ?

I have a INotifyPropertyChanged derived class with a Volume property (float, 0.0f - 1.0f) that gets set on a fixed frequency (say 30fps). I'd like to draw a tiny volumebar displaying this in my window. I don't want to use a normal databound progressbar, I'd prefer something simpler (and faster :)). Is there a proper way to simply draw a...

Extending Thumb control

I'm in the process of designing a WPF custom control, based on ItemsControl, which needs a Resizer/Splitter. This sounds pretty easy, I can just hook-up a few event handlers in my control and react to the dragging. But, I may also need to use this Resizer/Splitter in the content of the selected item. Ideally, the splitter would take i...

Why doesnt WPF border control have a mousedoubleclick event?

Why doesnt WPF border control have a mousedoubleclick event? I have a ItemsControl with some layout stuff in it for a DataTemplate. I want to handle the double click event to pop up a details dialog, but the border, my layout container, doesn't appear to expose the event. Any suggestions on how to either get at the double click event,...