wpf

How to display a byte array into a grid?

Hi, I have a byte array that can be very big in size. I want to bind it to a grid with a fixed size of column, lets say 10. so the first 10 bytes will be on the first row, the 10 next bytes will be on the second row... until the end of the array. I need to be able to edit any bytes and this need to be reflected into the array. My byte...

How to catch Click on ListboxItem when the item is templated?

I have a ListBox with ItemsTemplate set. Now I want to catch Ctrl + Left click on a ListBoxItem. I found KeyBoard class that should give me modifier keys. Now how do I get the click event on the ListBoxItem? Even better, how do I bind it to ICommand. I found some bits and pieces but don't know how to connect them. It seems InputBindin...

How to Snoop proof your wpf application?

Snoop allows you to look inside the application and change element properties. Its a great asset for developers, but can be a security issue in some cases, like when we have users who like to look in places where they shouldn't be looking. Is there a way to do something to block applications like Snoop from "snooping" your application? ...

wpf - UserControl inheritance

Hi I have problem with control inheritance in WPF. I created a UserControl named BaseUserControl. I want for this control to be a base control for other WPF userControls. So I another UserControl called FirstComponent. In next step I changed this code FirstComponent : UserControl to this FirstComponent : BaseControl However during...

Combobox Text displays different than in the Dropdown.

I want to have a combobox with dropdown list of codes and definitions, but only display the definition of the selected item in the textbox part. For example, Y-Yes and N-No in the dropdown, and when Y is selected, only display Yes in the textbox. ...

Convert into to byte array and insert into other array

Hi, I work in a c# wpf application in which I want to do several things. I'm working with byte arrays to compose MIDI Show Control messages (specified in the MSC Specification 1.0). The structure of this message is that a 0x00 byte is like a comma between all the parts of the message. I compose a message like this: byte[] data = ...

Extracting frames from a WPF storyboard

I would like to generate a set of still-frames from an animated WPF storyboard. My goal is to be able to specify a frame-rate, and 'record' any WPF Storyboard, which will generate still PNG images of each 'step' in the timeline. Then I can wire them together any way I like (animated GIF, AVI etc etc). Can anyone with indepth experience w...

WPF - Prevent Autoresize of ListBox on new Databinding?

Hey all, I currently have a window with a listbox within in. The listbox shows the results from a search. The problem I currently have is that when a search is performed and enough items are added to the listbox, the listbox expands vertically and forces the form to expand vertically as well. I know I can fix this with a maxheight, b...

How can I ensure that WPF UserControl elements are visible outside the bounds of the control?

I have a UserControl containing interactive elements within a grid. The user can move and resize these elements, often causing them to fall outside the bounds of my control. When elements do fall outside, I don't want them to clip. I want them to be visible no matter what. Unfortunately, setting ClipToBounds to FALSE did not solve th...

How to seek a WPF Storyboard to a specific frame/time offset when not running

I wish to seek to a specific time or frame using the ClockController.SeekAlignedToLastTick - however this does not appear to do anything, unless the Storyboard is running. I dont want to have to 'start' the storyboard, because I only intend the Storyboard to set all dependencyproperty values, and have everything lay-out for that time pos...

C# WPF how to enforce single instances of windows

I'd like to know what's the best way (read most elegant) to have a single instance of a given Window per application in WPF. I'm a newcomer to .NET and WPF and what I came up with looks pretty lame. private static readonly Object MUTEX = new Object(); private static AboutWindow INSTANCE; public static AboutWindow GetOrCreate() { l...

WPF - Need an event for when VirtualizingStackPanel creates Items for ListView

Is there any way to tell when the containers are finished being made for a ListView? A detailed explanation of what I've done so far I have a ListView control that has a DataTemplate in one of its columns that contains a CheckBox Control.. I've figured out how to access the CheckBox dynamically using the object that the ListView is bo...

C#/WPF: Why is tab not focusing properly

I have a tab control <TabControl Height="Auto" Grid.Row="1" ItemsSource="{Binding Tabs}" IsSynchronizedWithCurrentItem="True"> That is bound to Tabs in the ViewModel. I also used CollectionViewSource to focus tabs protected ObservableCollection<TabViewModel> _tabs; protected ICollectionView _tabsViewSource; public ObservableCollect...

How to change screen resolution in WPF?

Hi, how I can change screen resolution programmatically? And how to get a list of available resolutions for display? I tried to make how described in this article: http://www.c-sharpcorner.com/UploadFile/Joshy_geo/changescreenresolution10102006112110AM/changescreenresolution.aspx But Screen and Resolution classes do not exist in System...

XAML To MXML Conversion

Is to possible to generate MXML file using XAML file and vice versa??? Both are based on xml and contains similar type of coding.... So is there a way to convert XAML file to MXML file and vice versa? Thanks in advance... ...

Focusing WPF TreeViewItem when selection changes in another control

Hi All, In my WPF application I have a treeview which is loaded with certain collection. At the top of this tree view control i have a listbox which stores the same items as in the tree view whenever the tree view items are made favorites. I am trying to focus the treeview item whenever there is a selection made in the listbox. Though t...

raising event in a usercontrol from another usercontrol

How to raise a event in usercontrol from the another usercontrol. i tried to do with delegates, but it doesnt work. How can i do this. am using C#(WPF) usercontrol1.cs public partial class UserControl1 : UserControl { delegate void myDelegate(); public UserControl1() { InitializeComponent(); } private...

WPF: Removing a page from standalone app

I have a standalone app which contains lot of pages. Now if i need to delete a page, how do i do it? The page can contain a close button and on clicking it, that page has to be deleted. Then a page in forward or backward stack has to be displayed. Edit: Also i have a button "New" in the page. private void New_click(..) { this.Navigat...

How to arrange the elements?

I need to place objects 40% 40% 20% and that there were no scroll <Grid Grid.Row="1"> <Grid.RowDefinitions> <RowDefinition Height="40*" /> <RowDefinition Height="40*" /> <RowDefinition Height="20*"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDef...

C#/WPF: How can I from a ViewModel find out what is Selected in a TextBox?

How can I from a ViewModel, find out what is the selected text? What I am doing wanting to accomplish is similar to the WMD Markdown Editor here on StackOverflow when you bold/format text. Work on the selected text and modify it ...