wpf

WPF: How can I overlay a control on a window?

Right now I have a normal window with a bunch of controls. When the user hits a certain button I want to dim the entire window and then display a popup on top of it. Not a true dialog box, just something that is inside the window. So this is my theory... Every control is on layer 0. There is a rectangle the same size as the form in l...

Button Handler in codebehind C# WPF

Hi, I created some buttons in Code like this. if (infoLoader.categoriesLoaded) { sideBarButtons = new Button[infoLoader.categoriesLength]; for (int i = 0; i < sideBarButtons.Length; i++) { sideBarButtons[i] = new Button(); sideBarButtons[i].Content = infoLoader....

What features of WPF that are available through XAML are not available through C# (or VB, ...)

Is it possible to use all WPF functionality in C# (VB, ...)? Or is there any maybe advanced functionality that is not directly accessible from C#? (Maybe because it might not be accessible by public methods but rather internal.) ...

WPF - Resizing Columns and Rows in a Grid

Ok, i'm using the grid to list various content. How can I get specific colums to resize while others stay fixed. That is, form pops up with specifc Initial column sizes for the controls... if the user RESIZES the form... i want certain 'memo' like fields to expand. How to do that? i seem to only be able to get ALL 'second' column...

Access controls directly via its member variables

In my projects I have a lot of UserControls which contain other controls. Most of them are bound to a ViewModel, however at times I access them also directly from the code-behind to add special functionality or sometimes also only to save the ViewModel. If I do this, I do it always directly via the member variable of the control. Is t...

Naming of WPF-Controls in Markup

As I stated in another post, I access at times controls direct from the code behind. If I do this I name the controls as I do also in ControlTemplates and DataTemplates, I give them the prefix PART_ and after that I precise the name, for example… <TextBox Name=”PART_UserName” /> Is this against a common WPF naming scheme? Formerly I u...

Is there any semantical difference between element property syntax and atrribute property syntax?

I thought that element property syntax and attribute property syntax have no big semantical difference. However, I found that there must be some difference. E.g. The following example just demonstrates a simple trigger: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2...

WPF/Silverlight: How do you make a Button call ICommand.CanExecute when the command parameter is changed?

How do you make a Button call ICommand.CanExecute when the command parameter is changed? This is my current XAML. <Button Content="Delete" Command="{Binding DeleteItemCommand}" CommandParameter="{Binding SelectedItem, ElementName=DaGrid}" /> EDIT It appears this is only an issue in WPF. ...

WPF DataGrid different edit controls within a single column

I am developing a WPF 4.0 application where I need to make a grid that contains a column with either textbox or a dropdown depending on the row. Example: | Name | Value | Help | | PROP1A | [textbox] | Description of prop1a | | Prop2A | [dropd...

WPF: Is there a way to use a ValueConverter without defining a resource?

Is there a way to use a ValueConverter without defining it in a resource? As is the syntax is pretty verbose. ...

How to create an UI Designer utility?

I need to create an utility where user can create there own data entry screen. There should be an option to Drag and Drop normal UI controls (Textbox,TextBox,Radio Button, CheckBox, ListBox, Combobox and Image) to any container and arrange them depends on the user. Inface the use can change the background and default value for the TextBo...

Does memory leak if we set ItemSource property of a control to null in WPF?

I have a TabControl which is having 2 TabItems. Each of these two TabItems is having a listbox. On the SelectionChanged event handler I am setting ItemSource property of the appropriate ListBox to null and populating the other one with a Collection. Now when I keep on selecting each Tab there is a memory spike. What may be the possible r...

wpf/silverlight mvvm sample app request

could you guys point me to some really simple silverlight or wpf sample project where the usage of the MVVM is showed ...

what pattern should I use to couple .NET UI to a .NET library class that will provide callback updates

Hi, What's the best approach/pattern I should use for the following? Have a C# UI solution that will have (a) Winforms/WPF UI, and (b) class library. The UI will have to start a separate thread for the routine in the class library that will be polling The class library will then need to trigger a callback function in the UI to update ...

Finding a Control e.g. Label and assign its Content at runtime mvvm wpf

Hi, We have one xaml file in our Skins folder where designer has developed some styles for the labels,radiobuttons or checkboxes. I need to find the control, Label in this xaml file and assign the content property at runtime in virewModel so that it can automatically displays the content as per the records in the database. How to achiev...

How to determine whether a WPF DataGrid is in edit mode?

Is there a way to determine whether a WPF DataGrid is in edit mode / which row is currently edited? EDIT Duplicate: http://stackoverflow.com/questions/3248023/code-to-check-if-a-cell-of-a-datagrid-is-currently-edited ...

Frames per second using WPF's DrawingContext class

Hello! I've got an example app which draws Rectangles, Lines etc. using the DrawContext instance of the OnRender override of a Control class. This control is repainted every 10 milliseconds by calling InvalidateVisual (I can post the source to anybody who's interested). I calculate the Frames per second (FPS) by measuring the time betwe...

Constraint to limit the scope of an attached dependency property

Is there a way to add a constraint to an attached dependency property so that it only can be applied to a specific type, something in the metadata? If not, is it meaningful to explicit type the static Get-and Set-methods of the attached DPs? Example: If I have for example the following declaration: public static int GetAttachedInt(De...

ContextMenu in Style setter

Does anyone know why this would produce an XamlParseException "Cannot add content of type 'System.Windows.Controls.ContextMenu' to an object of type 'System.Object'": <ItemsControl> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas ClipToBounds="True"/> </ItemsPanelTemplate> </ItemsControl.ItemsP...

WPF: Change background color of a template

I have defined a menu template which, in theory, should use the backgroundcolor of the "AppBackground" SoliColorBrush, defined in a separate file. When in "debug mode", I use the following code to change that variable: this.Resources["AppBackground"] = new SolidColorBrush(Colors.DarkGreen); This has the intended effect on the applicati...