Questions tagged [wpf]

Windows Presentation Foundation, or WPF, is a subsystem for rendering user interfaces in Windows-based applications.

wpf
Filter by
Sorted by
Tagged with
1 vote
2 answers
8k views

WPF Binding Image Source

maybe stupid question, but I don't know anymore... I have ViewModel class like this: public class MainWindowsViewModel : INotifyPropertyChanged { private ImageSource _img; public ImageSource ...
GrowSing's user avatar
  • 613
1 vote
2 answers
307 views

live editing using MVVM pattern C#

I'm currently developping a tool to visualize some models inside a WPF application. One of my problems is the "live edition" problem using the MVVM pattern. In the screen shown under, I have my ...
Eastrall's user avatar
  • 7,801
1 vote
1 answer
5k views

How do I add multiple images in StackPanel WPF from Folder?

I want to give folder path and from that folder path If That folder contains 3 images I want to display those 3 images into StackPanel WPF Form I tried something like below which works fine for one ...
Neo's user avatar
  • 15.9k
1 vote
1 answer
5k views

WPF Image source doesn't update image

I'm trying to have a rotating ad display in my WPF application. When I load the application the GetNewAd() method properly displays the advertisement. When I try to update the ad by calling my ...
Traderman57's user avatar
1 vote
1 answer
454 views

WPF/MVVM navigation with direct ViewModel switching

I've started writing my first WPF/MVVM and as many other people have found, dealing with navigation between views is rather confusing. I've been searching for a while and most of the topics either ...
tab87vn's user avatar
  • 399
1 vote
2 answers
2k views

How can i make a custom made textbox appear when hovering over a button in wpf

I am trying to make something like this: Basically, I made the email button, and I want to make a custom textbox with text in it that slowly fades in when the mouse enters the Email button. Now, I ...
Ivan Horvatin's user avatar
1 vote
1 answer
3k views

Style trigger based on parent style property

I want to have buttons with little icons as content. The icons are defined and stored in a ResourceDictionary like this: <Path x:Key="BackIcon" Data="F1 M 57,42L 57,34L 32.25,34L 42.25,24L 31.75,...
matt-pielat's user avatar
  • 1,739
1 vote
2 answers
6k views

Using Dispatcher Invoke with a Runspace in Powershell

I am trying to learn how to use a Runspace to pass values to a GUI. I have been tweaking the script written by Boe Prox, trying to understand how Dispatcher.Invoke works with a runspace and came ...
Bregs's user avatar
  • 87
1 vote
3 answers
2k views

ComboBox KeyDown event how to take into account last pressed key

I have an editable combobox and have to handle the entered value (it has to be a number). In the keydown event I analyze combobox.text and act accordingly. Of course in this case combobox.text shall ...
Patrick's user avatar
  • 3,214
1 vote
1 answer
523 views

Set default location in telerik bing map provider

Am using telerik bing map and i need to search locations in a particular country without specifying that country name. "Is it possible to set default country or any location name in the map?" Any kind ...
Nandha kumar's user avatar
1 vote
1 answer
603 views

Binding function to textblock in listbox c# WPF

I'm learning MVVM so it can be newbie questions. I need to bind the function: private void doubleClick(object sender, MouseButtonEventArgs e) in the textblock : <Grid> <ListBox Name="...
user avatar
1 vote
1 answer
4k views

WPF: passing datagridrow object to converter

I've got a problem with passing object to converter in WPF. My DataGrid looks like: <DataGrid x:Name="customTasksDataGrid" Margin="10,10,10,38" Grid.Column="1" IsReadOnly="True" ...
Marcin Zdunek's user avatar
1 vote
1 answer
416 views

How to launch method when window got focus again in WPF?

My app is multi-window, here is quickly how it works: In main window I have a list of items, when I click on one, it opens another window where I can modify it. When I close that window, I want main ...
arti's user avatar
  • 645
1 vote
1 answer
534 views

Make Command's CanExecute depend on other field's value

I'm working on a small WPF MVVM application. In essence, the user browses for a file, then clicks "Execute" to run some code on the file. In my view model class, I've bound the two button clicks ("...
rookie's user avatar
  • 2,853
1 vote
2 answers
2k views

How to Write a Data Trigger to open Popup by Clicking dynamic Button in WPF?

I'm having a dynamic Button in my WPF application, while clicking any one of the button the popup should open and the corresponding Button should turn the Background Color to Orange and rest of the ...
B.Balamanigandan's user avatar
1 vote
1 answer
704 views

Load Assemblies as needed with Simple Injector

This question is regarding SimpleInjector at the moment, but could apply to any DI Container that may handle this issue a bit better... I am doing research for my firm right now. I feel a DI ...
Carson's user avatar
  • 1,179
1 vote
2 answers
3k views

Get Clicks per Second for a Button

I want to get the clicks per second for a Button and save it in _clicksPerSecond. I already got how many clicks the user did: private void button_Click(object sender, RoutedEventArgs e) { _klicks++...
Daniel Kng's user avatar
1 vote
1 answer
237 views

Bind user control value and add padding

I have two questions. 1: I have the second rectangle's size bound the first rectangle. How can I add additional padding to the size of the rectangle? For example Width="{Binding Path=Height + 5,... ...
JokerMartini's user avatar
  • 5,907
1 vote
1 answer
1k views

WPF how to change text color of a GridViewColumn?

I have this GridViewColumn: <GridViewColumn Width="180" Header="Status" DisplayMemberBinding="{Binding Status}"/> Now i want to be able to change this Column text color also via code behind. I ...
david hol's user avatar
  • 1,272
1 vote
3 answers
4k views

How do I ensure that onApplyTemplate gets called before anything else

I have a wpf Custom Control on which I have been working. It has a shared New like this: Shared Sub New() 'This OverrideMetadata call tells the system that this element wants to provide a style ...
Dom Sinclair's user avatar
  • 2,498
1 vote
1 answer
4k views

Custom app.config section error "Unrecognized element add"

I have a small app that searches my SQL Server database for the given value in all of the fields where it could be used. Part of that is a custom app.config section to hold all of these fields. ...
Steven Ball's user avatar
1 vote
1 answer
281 views

Vertical progress bar in xaml and vb.net?

Need help on creating a vertical progress bar in my application. Haven't started the app so no current code to work off, Just planning to see if this is possible, any input would be great, p.s. if ...
Connor Mcgrann's user avatar
1 vote
3 answers
2k views

ExtendedToolkit DatePicker Calendar FontSize

I am using the ExtendedToolkit for WPF C#. Specifically I am using the DateTimePicker, I have tried changing the font size for this element however it does not change the size of the attached calendar ...
CBreeze's user avatar
  • 2,945
1 vote
1 answer
649 views

Change content of GroupBox dynamically

I have a GroupBox. This box contains one UserControl <GroupBox Header="NewsBox"> <GroupBox.Content> <NewsDay:NewsDayControl DataContext="{Binding SelectedNews}"/> &...
Stampy's user avatar
  • 456
1 vote
2 answers
1k views

What exactly does a .Net Matrix3D Transform() do / why am I getting "- infinity"?

I'm trying to do a perspective transform on some 3D points. (if it helps, I'm trying to apply the algorithm described here). But basically, I have a Matrix3D with the following values: HasInverse =...
user316117's user avatar
  • 8,131
1 vote
3 answers
1k views

How to delete the auto-generate first line in a RichTextBox

I am wondering is there a graceful way in C# to delete the first line in RichTextBox, I am using RichTextBox to create a chat room, I would like to show the Date or Image by clicking a button , so ...
WickedFAN's user avatar
1 vote
2 answers
90 views

Call page but nothing appears

I'm back on the C# .net wfp application, I have my MainWindows, and when I try ty call a new page, the wpf xaml doesn't appear. this my code: public MainWindow() { ...
F4Ke's user avatar
  • 1,671
1 vote
1 answer
917 views

How to make Render Trigger Manual in SharpGL/WPF

I've installed SharpGL control for WPF. The control is always in Render Loop by which I mean it renders in certain intervals. What I want is a one time draw. Because I'm not making a game and I don't ...
Vahid's user avatar
  • 5,314
1 vote
1 answer
1k views

Use of offsets for translation in Matrix3D

I have an application where I want to scale, rotate, and translate some 3D points. I'm used to seeing 3x3 rotation matrices, and storing translation in a separate array of values. But the .Net ...
user316117's user avatar
  • 8,131
1 vote
1 answer
2k views

MVVM does not receive message

I am using mvvm light on my project. For communication between view, I am using GalaSoft.MvvmLight.Messaging.Messenger but it does not work as expected. The code below: Register a messenger ...
softshipper's user avatar
  • 33.3k
1 vote
1 answer
1k views

Bind DataGridColumns Header to DataContext of the window

I have a DataGrid and want to bind the Header-property to a property of my windows DataContext but I did not get it working. Binding can be such a pain as (for me) it is never clear which context ...
KingKerosin's user avatar
  • 3,727
1 vote
1 answer
2k views

Filtering an ObservableCollection Based on CheckBoxes

I have a DataGrid that contains a number of Jobs. Each of these Jobs has an employee associated with it, and I would like to filter based on which Employees are on those jobs. So I have four ...
CBreeze's user avatar
  • 2,945
1 vote
2 answers
295 views

How can return on current culture who user used in PC

I read csv file and columns is separate with comma. In some cultures the separator is point, and for this reason I decide to change current culture to "en-US", who use comma for separator. But after ...
Evgeni Velikov's user avatar
1 vote
2 answers
1k views

C# WPF better way to iterate on children and change property

I have to iterate through all children of a stackPanel. Being new to WPF I do that foreach (var item in spTab3.Children) { if (item.GetType() == typeof(ListBox)) ((ListBox)item)....
Patrick's user avatar
  • 3,214
1 vote
1 answer
1k views

show dialog with WPF window under Outlook VSTO add-in

I created Outlook VSTO application. I want to popup a WPF window dialog when click button. Here is my WPF window: <Window x:Class="WorkflowSR.View.ArchiveSettingWindow" xmlns="http://...
Elliot Li's user avatar
  • 452
1 vote
2 answers
147 views

Best way to delay execution

Let's say I have a method that I run in a separate thread via Task.Factory.StartNew(). This method reports so many progress (IProgress) that it freezes my GUI. I know that simply reducing the number ...
Rodolphe's user avatar
  • 1,722
1 vote
1 answer
328 views

How to stop WPF controls (using expanders) heights expanding to parent's height in ItemControl

I want to have a view of UserControls hostest within an ItemControl, using a WrapPanel as the ItemsPanelTemplate, for example, I Have <Grid> <Grid.RowDefinitions> <...
peterc's user avatar
  • 7,413
1 vote
1 answer
307 views

Data binding to the output of a method

I'm trying to display the output of a method in a WPF TextBox. I'm just trying a simple attempt, to print a single string 3 in a TextBox. I'm trying to do it the following way, using an ...
user5193795's user avatar
1 vote
3 answers
279 views

Way to prevent dependencies for ViewModels

For instance, I have a ViewModel for a View inside a popup control. ManagerView.xaml <Popup Name="Popup1" AllowsTransparency="True" Placement="Center" PlacementTarget="{Binding ElementName=AGrid}...
Tyress's user avatar
  • 3,613
1 vote
2 answers
4k views

Drag and drop event. Get the name of the control where the drag originated, whilst inside drop event method

I am attempting a drag and drop in WPF. My program allows you to drag coloured labels around the screen, in essence giving you the effect that squares are being dragged and dropped. Bearing in mind ...
Oisín Foley's user avatar
  • 2,737
1 vote
1 answer
1k views

WPF:Using checkbox IsChecked property in DataTrigger

I am trying to use WPF checkbox's IsChecked property in a DataTrigger.Based on the value i am setting particular DataGridRow's background. My NOT WORKING code <Style TargetType="{x:Type ...
shreesha's user avatar
  • 1,841
1 vote
3 answers
816 views

Based on a combo box value, change refresh timers

In .xaml.cs I have the following code DispatcherTimer timer = new DispatcherTimer(); // Default value for auto generation timer.Interval = new TimeSpan(0, 0, 5); ...
Badja's user avatar
  • 867
1 vote
1 answer
448 views

WPF Zebra EPL2 Printing issue

I am trying to print some labels to a Zebra printer via EPL2. Doing some searching for raw printing point me to this. The problem with that link is its for a Windows Forms and not a WPF Application. ...
Xaphann's user avatar
  • 3,437
1 vote
1 answer
1k views

Shutdown Block Reason API for WPF is not working

I have application, which should block Windows shutdown in particular situations (or at least notify user, that he should not shutdown PC yet). I'm using Shutdown Blocking Reason API mentioned here (...
lentinant's user avatar
  • 822
1 vote
1 answer
107 views

MenuItem's sub menu don't open

I have a MenuItem with sub-buttons in a ToolBar: <ToolBar x:Name="toolBar" VerticalAlignment="Top"> <Button x:Name="btnNew" Content="New"/> <MenuItem x:Name="miWindow" ...
SeyoS's user avatar
  • 661
1 vote
1 answer
1k views

Get/Calculate the correct size of a Control after Render/Layouttransform was applied

I'm trying to get the size (width/height) of an Image control after I applied a Transform to it (either Render- or Layouttransform, doesn't matter in this case). My Image control is embedded in a ...
Steffen Winkler's user avatar
1 vote
1 answer
930 views

WPF getting class instance null reference on XAML

I'm getting null reference on trying to set up a class instance to my XAML. XAML Code <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/...
Erick Gallani's user avatar
1 vote
2 answers
5k views

DataGrid LostFocus Event Raised when User Changes Row

Here is the XAML used to create a datagrid: <DataGrid x:Name="dgrComments" Height="200"> <DataGrid.Columns> <DataGridTextColumn ...
SezMe's user avatar
  • 521
1 vote
2 answers
495 views

How to bind to a property of an instantiated class in XAML

I was wondering if it is possible to make a reference to an instance made in code behind of a class, with XAML. For example: I have two clasess, MainWindow and MainWindow_ViewModel. MainWindow is ...
FjjF's user avatar
  • 87
1 vote
1 answer
2k views

Scrollbar or ScrollViewer when windows sizes reduces

I want to know if there is a way to not size the width and height of a grid I have but when I reduce the size of a window if my graph becomes a certain width/height then the corresponding scrollviewer ...
Ryan Archibald's user avatar