wpf

How to apply a global style (allowing hightlighting after focus is lost) to a wpf treeview

I found the following code for showing the selected item in a treeview when focus has left, but I'm having trouble moving the code to App.xaml so any UserControl could use it. This does what I want <TreeView x:Name="trviewArchives" Width="141" Height="154" Canvas.Left="20" Canvas.Top="167" Background="{x:Null}" BorderBrush="#FF08182...

do exist any succesful project using mvvm? (designer viewpoint)

Preface : i know, exist several topics talking about MVVM and how it is good (or bad) but my question is a bit different :i want to know if really exist any successful project that uses partially or completely MVVM, all all as a designer viewpoint. I am starting another project using MVC (web), i have some experience with it and it wor...

Showing Dialogs in MVVM & Setting dialog options

I am just wondering is this the way to show dialogs in MVVM? public ICommand OpenFileCommand { get { if (_openFileCommand == null) { _openFileCommand = new RelayCommand(delegate { var strArr = DialogsViewModel.GetOpenFileDialog("Open a file ...", "Text files|*.txt | All Files|*.*")...

How do I stop a video at a specific time using Blend/WPF in C#?

How do I stop a video at a specific time using Blend/WPF in C#? Example: When I clicked on a "TreeViewItem" called "MONDAY", the video will start to play. But up to 10sec of that video, I want it to stop. As after 10sec, that video will be showing video of another "TreeViewItem" called "TUESDAY". And when the video is stop, the "Slide...

Binding to DataContext outside current ItemsSource context

Hello, I have a DataSet bound to the Window.DataContext; I also have a DataGrid <DataGrid ItemsSource={Binding Tables[Items]}> <DataGrid.Columns> <DataGridTextBoxColumn Header={Binding Path=DataContext.Tables[Names]/Test, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}} /> </DataGrid.Columns> <...

Ignore Keyboard Input

I have an application that displays a keyboard and tests whether the keys have been pressed or not. The issue I'm having is that when certain keys are pressed like the arrow buttons/tab, the keyboard graphic loses focus and it starts accessing menu items/etc. I tried registering to the preview mouse down event in the MainWindow and set...

Working with WPF(C#) calendar control, hebrew and georgian dates conversion

I need to build a simple app, A calendar with notes, working with a simple db and standard calendar is easy. the problem is with a feature that i must add: I need that every note will have a Hebrew date and Georgian date; It should work "on the fly", meaning: a user will have the ability to add a note based on a date type of his choice,...

How do I stop a running video using Blend/WPF?

How to stop a video after playing 10 sec. And the video slider will also stop. thanks. My coding: if (threeA.IsSelected == true) { Video.Source = new Uri(@".\step_3.wmv", UriKind.Relative); Video.Play(); descriptionText.Text = "Stepping out."; // When the video play until 10sec, both ...

Use Radial Panel in Listbox, throwing exception VisualTree Single Element

Hi Guys, I have a very simple radial panel with a few dependency properties like so: public static readonly DependencyProperty RadiusProperty = DependencyProperty.Register("Radius", typeof(double), typeof(CircularPanel), new PropertyMetadata(50.0, new PropertyChangedCallback(RadiusChanged))); private static void RadiusChanged(Dependen...

How to remove a style?

Let's say we define button style in .Resource tags. The style is apply to all button (TargetTye=Button, x:Key is not set). In some parts of my application, I want to turn this style off. I seek for a solution where a "style undo" feature can happen. Like typing in MS Word, when you try some formation (bold/underline) - should read as a...

Forcing a threestate checkbox to not move to indeterminate state

HI, I'm working in WPF and i have an interesting requirement. I need my checkboxes to be ThreeState, so if only some of the child elements are selected it shows as indeterminate. But when a use clicks it, i want it to select either true or false. Here is a story to represent my requirements: item - indeterminate subItem - checked...

How to change ancestor's property with a trigger on template child

I have a combobox and I have templated its control template. Togglebutton is a part of the control template. Now when a event is raised on the togglebutton(ex: Checked), I want to change combobox property(ex:Foreground). How to do this? Can we do this using relativesource? ...

[C#] How to play a running video from 1sec - 20sec in Blend/WPF

To play a video for just 20sec out of the whole video in Blend/WPF using C# language? Thanks. ...

How to get the corresponding WPF theme with the current Windows theme?

Let's say in my application, there are two regions: 1) used customized theme, and 2) used the system theme (the theme selected by the user in his Windows OS). Region 1 uses the customized themes whilst Region 2 uses the default themes. The official default WPF themes can be downloaded here. What I need is to know the current theme that ...

How do I make WPF TextBox acted as a compact form?

How do I make WPF TextBox acted as a compact form? This means that "label text" inside TextBox is hiding on the click or when there is "real text". See working prototype ...

WPF custom command in context menu are disabled until any button clicked.

I have a custom command and I try to execute them from the context menu, but they are always displayed as disabled unless I click any button on the UI (buttons do not have anything to do with commands). After clicking a button, commands start to be displayed correctly (when they are unavailable they get disabled and enabled if availabl...

how to set the usercontrol for ribbon window wpf

First I've create a wpf application, then i add new RibbonWindows to application, say it RibbonWindow1, now i want to set the content of the ribbon control via bellow code and show the ribbon: RibbonWindow1 ribWindow = new RibbonWindow1 { Title = "This is a ribbon window", Content = new UserC...

How Dependency Property works?

I have next dependency property: public static DependencyProperty RequestObjectProperty = DependencyProperty.Register("RequestObject", typeof(RegistrationCardSearch), typeof(RegCardSearchForm),new UIPropertyMetadata(Changed)); private static void Changed(DependencyObject d, DependencyPropertyChangedEventArgs e) { Me...

datagrid is larger than usercontrol

Hi, My Mainpage has a menu that loads usercontrols into a Stackpannel. I've got several usercontrols and some of them have a datagrid. But when I bind a large collection to the datagrid, the datagrid gets much larger than the usercontrol. How can I set the max width/height of the grid to the size of the usercontrol. It seems that the us...

WPF - Controls inside the Listbox

Hi All, i am displaying images inside the list box. If the image URL doesn't have image means it will display textblock with Book title and Author name. Problem: If the image is available i want to hide the textblock. Code: <local:ImageConverter x:Key="myImageConverter"/> <Style x:Key="ListBoxItemStyle" TargetType="{x:Type Lis...