WPF How to change the color of a gridviewcolumn

To preface the bulk of the question, I've found several answers regarding CellTemplate and DataTemplate, as well as one setting HeaderContainerStyle, and none of them worked; results ranged from no change to a crash. I'm trying to change the color ...
more »

2017-10-14 15:10 (1) Answers

how to connect line and circle at border of circle

I'm new to c# and wpf and I want to draw a graph . I used CappedLine.cs for edges and ellipse as nodes. I want to draw lines until they reach to circles and do not enter to the boundaries of the circles. anyone can help me throughout this problem? h...
more »

2017-10-14 12:10 (1) Answers

Visible 2D content bounds of WPF ModelVisual3D

In WPF, we can easily use VisualTreeHelper.GetDescendantBounds(Viewport3D) to get the visible 2D content bounds of a ModelVisual3D without transform. However, when the ModelVisual3D transfromed, GetDescendantBounds returns a bigger bounds than the vi...
more »

2017-10-14 04:10 (2) Answers

Pass event through classes C#

I have a first class that raises an event when some changes occur: public class MyFirstClass { public event EventHandler ChangesHappened; public MyFirstClass() { } public void MyMethod() { //Thing happened Changes...
more »

2017-10-14 01:10 (3) Answers

Bind to property only if it exists

I have a WPF window that uses multiple viewmodel objects as its DataContext. The window has a control that binds to a property that exists only in some of the viewmodel objects. How can I bind to the property if it exists (and only if it exists). ...
more »

2017-10-13 21:10 (1) Answers

Xaml unhandled exception popup not appearing

Hey I am having an issue with my error handling. Basically I am trying to show a popup allowing the user to input any steps they took when an unhandled exception happens. I can do it fine if I write it as a regular c# popup but this is not the case i...
more »

2017-10-13 21:10 (1) Answers

Declare array of array in xaml

I'm trying to use an inline data source for a data grid, and obviously XAML supports array of builtin types with x:Array, but when I tried to declare a nested array, tried a few ways but none of them works. <x:Array Type="{x:Type Array}"> ...
more »

2017-10-13 11:10 (1) Answers

SelectionChanged fired also on nested controls?

Sorry for misleading title, I'll try to explain better. I've a TabControl like this: <dragablz:TabablzControl SelectionChanged="MainTabs_SelectionChanged" x:Name="MainTabs"> where inside I've different TabItems, I need to fire the event Main...
more »

2017-10-13 11:10 (1) Answers

C# WPF RibbonButton Change Icon on MouseOver

i have a Ribbonbutton wich i want to change the Icon on MouseOver but it does not seem to work. Here is my Code: <RibbonButton Label="Verbindung testen" LargeImageSource="../Resources/Buttons/disconnect.png" Command="{Binding SettingsVM.TestCon...
more »

2017-10-13 10:10 (1) Answers

c# wpf importing excel performance

I'm importing a large excel file that can vary in length (250+ columns * 100,000 rows), it holds columns of data, where amount of columns and their names can change, rows are also variable but they are the values. I'm using Interop to pull the data ...
more »

2017-10-12 21:10 (2) Answers

Add a colored Ellipse to MenuItem

I would like to add an Ellipse to some MenuItems of my ContextMenu. Sadly I could not get this to work [Nothing is displayed]. Canvas canvas = new Canvas() { Height = 16, Width = 16 }; canvas.Children.Add(new System.Windows.Shapes.Ellipse() { H...
more »

2017-10-12 16:10 (1) Answers

StackPanel childs auto resize

I'm trying to create a form that contains three grids, each grid has DataGrid and Button in one row and in a row below I have GridSplitter to resize content. I would like that on form display content is resized proportionally to the screen size. I k...
more »

2017-10-11 21:10 (1) Answers

Wpf Command Binding to ViewModel or Model?

I have a several models and a TreeView to display them. The HierarchicalDataTemplate displays the Models using ItemsSource. Ruff outline... public class ModelA : ObservableBase { private string _name = "A"; private Observablecollection<ModelB...
more »

2017-10-11 15:10 (1) Answers

Calling a method from a different ViewModel

I'm writing a program for managing a tool inventory and have run into a problem when I have the users mark a tool as 'fixed'. The program should work as follows: Using TIView, TIViewModel, TIModel: Employee checks tool out. Tool happens to get da...
more »

2017-10-10 20:10 (1) Answers

Error: OpenCV: Overflow for image Size

I am trying to use my camera through the EmguCv library. Following their documentation, I am doing the following: Capture capture = new Capture() Mat frame = new Mat(); capture.Retrieve(frame, 0); image1.Source = BitSourceConvert.ToBitmapSource(fra...
more »

2017-10-10 19:10 (0) Answers

Powershell WPF Combobox No Item

I can not add objects in a combobox. I searched on internet and try several test I think it's all simple... Thank you ! Add-Type -assemblyName PresentationFramework Add-Type -assemblyName PresentationCore Add-Type -assemblyName WindowsBase [xm...
more »

2017-10-10 16:10 (0) Answers

Binding Command to ViewModel inside UserControl

I want to bind a UserControl to a ViewModel to use Commands/Events. My application consists of a MainWindow with a ContentControl inside, which is used to display a UserControls (the actual content) for navigation purposes. MainWindow.xaml <Wind...
more »

2017-10-10 15:10 (1) Answers

WPF Treeview and databinding a Directory Tree

I'm trying to implement a Directory Tree View that also shows all the files in my MVVM project. My Folder and Files structure in the Model is like this: public class UserDirectory { private ObservableCollection<UserFile> files; private O...
more »

2017-10-09 18:10 (1) Answers

Navigate through TabItem using MVVm

Assum that I have 3 user Control(TIShowNames,TIEnterCode,TIShowFactor). they have their views and their corresponding viewModel. all these 3, are in mainwindowView. Here is my mainwindowView Xaml: <Controls:TransitionPresenter Name="transContai...
more »

2017-10-09 16:10 (2) Answers