Questions tagged [wpf]

63365 questions
1

votes
0

answer
224

Views

Unable to get rid of ambiguous path error

I've had a look at this post but still can't seem to fix this problem: Resolving an ambiguous reference I'm trying to make a button in WPF that when clicked browses for an excel file and then opens it. However I keep getting the error 'Path' is an ambiguous reference between 'system.windows.shapes...
Friend
1

votes
0

answer
254

Views

VB.net WPF and Win 10 Toast Notifications

I'm trying to show toast notifications in Win 10 from vb.net WPF app. 1. I added 10.0 to .vbproj file in the section. 2. I Added references to Windows.Data and Windows.UI 3. My code: Class MainWindow Private Sub BtnClick() Dim ToastN As ToastNotification = New ToastNotification('Test', 'This is tes...
RadiM
1

votes
0

answer
46

Views

Why datepicker not appearing in my datagrid

Why datepicker is not appearing in my datagrid. I have textblock, one datepicker and then again textblock in total three columns, Those two textblocks appears properly but the datepicker do not appear. whereas there is no problem in binding because if a have applied same in the listview and there th...
testCoder coder
1

votes
1

answer
112

Views

Binding DataGridComboBoxColumn to enum value

I'm trying to bind an enum value to DataGridComboBoxColumn, but it does not work. In my case i want to bind the enum CamSegmentType to the DataGridComboBoxColumn. It seems that the enum eCamType could not be found. I don't know what's wrong. XAML: Code: namespace WpfApp1 { public partial class Main...
Richard
1

votes
3

answer
25

Views

Cannot remove selecteditem in DataGrid

I've a DataGrid that bound a List of contacts:
MrFantastic
1

votes
1

answer
20

Views

Image not taking whole of the space in the DataGridCell

I have a Datagrid, which shows thumbnails of some image files along with other data. I am using a converter to crop part of an image and then show that cropped image in the Datagrid. Here is the screenshot of the grid: The image is showing fine, but it is very small.If I change the width of columns...
V K
1

votes
0

answer
152

Views

Defining window buttons in ironpython wpf

I have made a simple GUI where I added manually the close, minimize and maximize buttons. However, I cant figure out how to add the command that once I click them, they do what expected. The code looks as following: import wpf from System.Windows import Application, Window from teleb_Data import boo...
Ben
1

votes
1

answer
52

Views

Switchable connection strings via code at run time

I have a WPF application. It has many blocks that access the database. The connection string is determined by a setting in my App.config file. using (var dbContext = new MyEntities()) { // ... } But now I need the ability to switch between different databases at run time. I've updated the code to ma...
Jonathan Wood
1

votes
1

answer
138

Views

How to pause a for loop until DispatcherTimer has ended?

I want the for loop to wait until the timer has finished, and afterwards continue the for loop. How do i need to do this? I tried with await & async, i am doing something wrong. What it does now: the loop starts, runs the timer but does not wait for it to finish. So it loops on, and starts up the ti...
B5891
1

votes
0

answer
166

Views

Line graph automatically connects with other collection in DynamicDataDisplay WPF MVVM

In my project, i have to display multiple line graphs dynamically. If i bind more than one dynamic collection to my D3 line graph, every collection end point gets automatically connects with next collection first point. Please help me to differentiate line graphs.
Bala
1

votes
2

answer
32

Views

Disallow “Background” Window from Being Active WPF

This one is a little hard to explain, it has more to do with .NET and the Windows operating system than WPF, but I have a WPF app that has a 'MainWindow' and in this window there is a menu such as File, Edit, etc. If a user clicks on one of these menu items, a dialog window will appear via the Show...
J-man
1

votes
1

answer
300

Views

how to unsubscribe an event with parameter(s)?

In my WPF program, I need to set aircraft failure for a flight simulation software. For example, if I click 'Fire Engine 1' button on MainWindow, private DispatcherTimer DT; private void button_Engine_1_On_Fire(object sender, RoutedEventArgs e) { SettingFailureCondition('Fire engine 1'); } Then a p...
Jeff
1

votes
1

answer
320

Views

WPF MouseEnter/MouseLeave/MouseMove Event Tunneling

I am trying to make a button where the contents change when the mouse enters the button. Currently, this is the code that I'm working with: Xaml C# Code-Behind File private void One_OnMouseEnter(object sender, MouseEventArgs e) { Button b = sender as Button; if (b != null) { b.Foreground = Brushes.P...
1

votes
0

answer
49

Views

Simply creating a RenderTargetBitmap in App.OnStartup causes memory (only when MainWindow is created too). What is it causing?

I scavenged various SO threads, MSDN and also this bug report on connect but I do not understand, what actually causes the memory leak in the following trivial WPF project (this is a repro, just create any new WPF project and put this into App.xaml.cs protected override void OnStartup( StartupEventA...
Samuel
1

votes
1

answer
26

Views

How do I pause execution in Matlab, but allow Copy\Paste via the keyboard

My question is similar to this: Wait for gui to finish - matlab But, the uiwait(f) doesn't work - when the user hits Ctrl-C it closes the app rather than doing a copy. Here's the situation: We're compiling MATLAB, and running WPF on top to provide the UI. However, we need to block the MATLAB executi...
Joe
1

votes
0

answer
280

Views

Alternative for TreeView widget in Universal Windows

I have to develop UWP program, and I have found that to use a regular TreeView Widget, what is supported in Windows Forms, is too much overhead. So I have to substitute this part of my GUI with something else. This is an example of my desired data hierarchy House #1 Person #1 Person #2 Person #3 Pe...
Andrey Mazur
1

votes
1

answer
548

Views

c# wpf mousedown and mouseup

I'm trying to create a program that connects two objects. When MouseDown on the first object, I remember it (without releasing the mouse button), when I MouseUp on the second object, I want to create a connection between them, but when MouseUp on the second object, this event is triggered on the fir...
D. Malakhov
1

votes
0

answer
38

Views

How do I maintain my custom type during a RichTextBox copy paste?

I have a custom class derived from Hyperlink: [Serializable] public class MyHyperlink:Hyperlink { public MyHyperlink():base(){} } I add it to a FlowDocument inside of a RichTextBox and then serialize to xml with XamlWriter.Save(thedoc) resulting in the following, showing my custom type: Juicy Lin...
NWoodsman
1

votes
0

answer
287

Views

Failed to create Browser Error (Access denied)

I'm getting 'Failed to create Browser' error when using multiple instances of my app. I use different folders for each instance as advised. Error: Failed to create Browser. System.ComponentModel.Win32Exception (0x80004005): Access is denied at System.Diagnostics.ProcessManager.OpenProcess(Int32 proc...
Samuel
1

votes
0

answer
28

Views

WPF Ribbon IsMinimized take effect only after clicking somewhere on the screen

When using MyRibbon.IsMinimized = true; the minimize take effect only after clicking somewhere (anywhenre, even outside the application) After MyRibbon.IsMinimized = true; and Before clicking somewhere: After Clicking anywhere on the screen or even on other place outside the app:
Yuval Levy
1

votes
1

answer
75

Views

ComboBox missing items

I'm facing a weird problem with ComboBox. I would like to represent key combinations in a ComboBox, where every key is on a Canvas. Binding works just fine, and after initialization it looks ok, but when I click on it and expand the dropdown list the current selected item will be empty and if I cha...
Dávid Kalmár
1

votes
0

answer
251

Views

Using Simple Injector with EF in WPF app

In my wpf app I need to be able to read/write data from specific table/tables, so, as I'm using SimpleInjector to use all services and stuff. So, basically I want to be able to use repository in some of my services. First I found this How to use Simple injector, Repository and Context - code first A...
DanilGholtsman
1

votes
0

answer
112

Views

Xceed datagrid crash

I'm new to Xceed datagrids, and I've been tasked with fixing a bug where the program crashes when there is a duplicate record, and then you click on the 'custom filter' button (dropdown shown): The program will crash when there are two date-times that are the same and you click on the little custom...
AidanH
1

votes
0

answer
69

Views

GarbageCollector Dictionary<Int64, WeakReference<Object>> grows up in my WPF App

I'm developing a navigated WPF Windows App based on pages, and i have some problem with weak references. I develop my App with the tips from this blog, and i have no problem with memory but... Every time when UI will by navigated to other page, grows the week references Dictionary. I call RemoveBac...
Stefan W.
1

votes
1

answer
121

Views

Stopping Main Thread with MessageBox

I query the database on a separate thread and generate a MessageBox for the user. I want the user to stop what he's doing and respond to the MessageBox. With my code below, the message box doesnt even pop up over the current window. The user needs to click on the taskbar to see it. How can I get it...
user9199295
1

votes
1

answer
199

Views

Why is my main window in wpf not updated when I change a binded page property?

In my MainWindow.xaml I have: In my MainWindowModelData I have a property called ContentView: private Page _ContentView; public Page ContentView { get { if (_ContentView == null) { LicenceManagerModel pModel = new LicenceManagerModel(); LicenceManagerViewModel pViewModel = new LicenceManagerViewMode...
Jos
1

votes
0

answer
36

Views

Using WPF DesignInstance with deserialization

I would like to use design-time data for the DesignInstance of my WPF UI view. However, in order for the default constructor of the associated ViewModel to work, I need to read in some configuration information from an external file. (At runtime, I deserialize the information from json.) The problem...
kmote
1

votes
0

answer
92

Views

WPF: How to detect text trimming with TextBlock and multiple lines of text

I have a TextBlock object in my WPF application and as the text content changes, I need to adjust the font size so that the text is never cut off and the entire text is visible. From another post, I tried using the following XAML to resize the font but this doesn't seem to work. I've also tried to d...
user2975847
1

votes
1

answer
176

Views

WPF RichTextBox Touch Scrolling doesn't work

I have a rich text box control, that I wish to be able to scroll by touch. The MSDN documentation says I should set this property: https://msdn.microsoft.com/en-us/library/system.windows.controls.scrollviewer.panningmode(v=vs.110).aspx However, this makes no difference, touch events still select tex...
Gru
1

votes
0

answer
25

Views

VisualDiagnostics.VisualTreeChanged event without attached debugger?

In WPF there is an event VisualDiagnostics.VisualTreeChanged that triggers every time a new element is added to the visual tree (anywhere). The problem is that this only works when a debugger is attached to the process. Is there any way of getting around this limitation? Any other similar event that...
Andreas Zita
1

votes
3

answer
50

Views

C# WPF StartupEvent get path

My objective is that when I open a file with a specific extension it will open my program in C#. That part is done but now I want to get the path of the file that I clicked on previously. This is just the main code of App.xaml.cs: /// /// Logique d'interaction pour App.xaml /// public partial cl...
Greenkiller
1

votes
0

answer
42

Views

An issue with CheckAll using EventTrigger on RadGridView

I am using a RadGridView to display data to users. I had added a Check All checkbox control to enable uses to select all records. For this matter, I have used EventTrigger and it's working just fine. but recently I have noticed that CheckAll would select prior pages' items displayed on RadGridView p...
Abdulkarim Kanaan
1

votes
0

answer
54

Views

how to set focus programatically to a specific property item in xceed propertygrid

The closest solution posted was for a Mindscape propertygrid, so does not exactly translate. http://www.mindscapehq.com/forums/thread/1222 It uses an attached property. I am stuck on how to implement the attached property. I get this error in the XAML designer and when I try to run the app. System.W...
RasThavis
1

votes
1

answer
60

Views

Enable sort for wpf DataGridColumn which source is converted value

In my wpf/c# project I have datatype with 3 dimensions: length, width and depth. When user inputs those in datagrid the volume for this item is calculated in 4th column using converter. What I want is to enable sort for this column. I tried to put SortMemberPath to Converter return value, but this d...
Andrew Miller
1

votes
1

answer
80

Views

ListBox contextMenu SubItem Click

I have ListBox with ContextMenu, I have configured MenuItem to works only if I click in selected item. This is XAML code: I tried to add Click event in my MenuItem but it doesn't work. Example: private void MessagesLbCopySubMi_Click(object sender, RoutedEventArgs e) { MessageBox.Show('Click event do...
xXConcasXx
1

votes
0

answer
97

Views

WPF pool game-like slingshot interaction on canvas

Good day everybody, I have a touch-only application in which I would like to create a slingshot interaction that you could find, for instance, in a pool game. Something like Angry Birds, but without the physics of gravity, just inertia and deceleration. To get a rough idea : For now, I have a Bounci...
Simon Ferreira
1

votes
1

answer
65

Views

Change button in datagrid edit mode with templateselector

I would like to change the behavior of a button in an DataGridTemplateColumn by CellTemplateSelector if the row is newly added or in edit mode. The button should normaly labeld 'DELETE' but when in edit mode it should be labeld 'INSERT' and call an other method. Here what I have found on other examp...
Hraaig
1

votes
1

answer
87

Views

System.OutOfMemoryException when calling Path.GetFullPath()

My code here var fullPath = Path.GetFullPath(input); throws OutOfMemoryException Insufficient memory to continue the execution of the program when I pass this value '\\.' as argument. Any explanation as to why Path.GetFullPath('\\.') crashes? XAML: ViewModel: // Implementation of IDataErrorInfo publ...
mark uy
1

votes
0

answer
33

Views

Referencing resource inside usercontrol not working

I have a Wpf Application with the following structure MainSolution -> Views (folder) -> NextGenDG (WPF Project) ->DisplayResources(folder) -> BRUserControlStyles.xaml Here is BRUserControlStyles.xaml Now I am trying to use the style inside a UserControl that is inside a folder called UserControls a...
Nikhil ans
1

votes
1

answer
32

Views

c# wpf combobox column in child datagrid

I am working on a WPF application with two DataGrids—one for TimeCard objects and a second for time card line (“TcLine”) objects. There is a one-to-many relationship between TimeCards and TcLines. The TimeCard datagrid is set up with a SelectionChanged event which populates the child datagrid...
TJLaser Shepard

View additional questions