wpf

How to format plain text in WPF RichTextBox

hi everyone, I have developed a small chat client using WPF. In each chat window, it contains a richtextbox to display previous chat conversations and a textbox with send button to type a chat message. I want to format the display text in the richtextbox as shown below. user1: chat message goes here For the time being, I use AppendTex...

NHibernate and INotifyPropertyChanged

I am having some issues with binding to objects retrieved from NHibernate using lazy loading. I have read some on the issue and am confused on what I need to do to fix things here. As I understand it the issue has to do with the way NHibernate handles the proxies for things that haven't been loaded yet. Has someone implemented NHibernat...

how to show Messagebox in MVVM.

I want to show message box in my MVVM WPF application. so from where to call MessageBox.Show(). ...

WPF - how to determine why this XAML style code is not working?

Any advice how to fault find to work out why the Grid.Resources styles in this XAML is not making any difference it seems to the end result? Note I'm using Charting from the WPFToolkit so to adjust how a chart looks it seems one has to apply the style areas (suggested by someone on the forum). So my question is generically, noting...

setting text on DataGridTextColumn

I am using a DataTrigger to replace empty cells with '-' text. My code: <DataGridTextColumn Header="Time taken" Binding="{Binding Path=finish}" Width="Auto" x:Name="x"> <DataGridTextColumn.ElementStyle> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <DataTrigger Binding="{Bindi...

WPF: Locate Parent Window from ListView ViewBase

I have a ListView that allows the user to change the ViewBase through a Context Menu (it acts like a simplified version of windows explorer). <ListView Name="lv" Grid.Row ="0" Grid.Column ="1" > <ListView.ContextMenu> <ContextMenu> <MenuItem Header="View1" Click="SwitchViewMenu"/> <M...

C#, WPF - setting alignment property by reflection with a string value

Hi, I'd like to set align property (horizontal/vertical) of an object through reflection, with a value of type string. I use something like private void SetPropertiesFromString(object nav, string properties) { Regex r = new Regex("(?[^~]*)~(?[^]*)"); MatchCollection mc = r.Matches(properties); Type type = nav.GetType(); ...

Reset TranslateZoomRotateBehavior? (WPF/Blend behavior)

I have attached a TranslateZoomRotateBehavior to a Grid: <Grid> <!--all sorts of content--> <Button Content="Cancel" Click="CancelButton_Click Width="25" Height="20"/> <i:Interaction.Behaviors> <ei:TranslateZoomRotateBehavior ConstrainToParentBounds="True" SupportedGestures="Translate"/> </i:Interaction.Behaviors...

How to Add Dynamic Column in listview Wpf

hello all i have a problem i want to add Colomn ( Dynamic using C #) in listview in Wpf how can i achive it and why we using grid view inside Listview in Wpf plz help me out thanks shashank tyagi ...

What is the difference bettwen GoToPlaylistItem and GoToPlaylistItemOnNextTick

Unable to understand the difference bettwen GoToPlaylistItem and GoToPlaylistItemOnNextTick, though GoToPlaylistItemOnNextTick clicked on scenarios where GoToPlaylistItem din't work. If you wonder if there are any differences, Have a look at this Post for a problem solved by using GoToPlaylistItemOnNextTick while it was throwing null...

Porting Silverlight DataGridFrozenGrid to WPF

Okay. I want to transfer a number of templates from an Expression Blend Silverlight application to a WPF one. All was going well until I came across DataFridFrozenGrid which is a Silverlight specific control. See here for more information. The description is that it is a non-scrollable DataGrid. Has anyone any experience of porting th...

MVVM WPF: Reflecting a controls property to the viewmodel, when an events get triggered.

Okay i'm trying to understand WPF and the popular MVVM Pattern. Now i have this issue. I'm using a ribbon control with several tabs. In my ViewModel i have a property "ActiveTab (string)" Which should reflect the currently active tab. Since ribboncontrol doesn't have any property that shows this information i can't bind to it. So i wa...

WPF datagrid start editing new item

Hi, I have a datagrid with editable items in it and I have a button to create a new instance of such an item. The datagrid is updated with the new item but I can't select the recently added item and start editing on it. Below is my code: private void btnNewKenmerk_Click( object sender, RoutedEventArgs e ) { Kenmerk newKenmerk =...

DataGrid new row added event

I have a datagrid with a long content list and its first row is selected as default. I want the scrollbar of the datagrid to be scrolled to the bottom, when a new row is added. I thought I achieved this by a selectionChangedEventHandler and scrollIntoView(item) method, but I just realized that when I try to scroll down by hand-without ch...

Use a LinearGradientBrush in another LinearGradientBrush?

Hi, I'm trying to use one LinearGradientBrush in the Definition of another LinearGradientBrush. But I've no idea weather this would even work, and if it works, I need to know how. For Example: <LinearGradientBrush x:Key="ComboBoxFocusBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFFDEEB3" Off...

how to Save the State of an c# App with powerShell?

Hi! I have a C# program in which the user adds multiple objects an editing Panel. These objects are all represented as a classes. Now I want the user to be able to save the scenario, so it can be loaded again. for that I want to generate a Powershell script of each scénario , but my probléme is how to save diferent objects on Powershel...

Event firing problem in WPF

I have following grid: <Grid x:Name="grd" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="100" > <Button x:Name="but" OverridesDefaultStyle="True" Width="50" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top" > <Button.Template> <ControlTemplate TargetType="{x:Type Button}"> ...

Force binding update in XAML

I have a View with a Listbox and several textboxes bound to properties of the objects displayed in the listbox. On opening, the listbox is populated with data, and I have the following in the style to ensure than when there are items and nothing is selected, to select the 1st item. <Style.Triggers> <MultiTrigger> ...

WPF: Disable DropShadow / BitmapEffects for ComboBox

My WPF Application is kinda slow in high resolutions when it comes to ComboBoxes. I am pretty sure its the BitmapEffects on the ComboBoxes, especially the DropShadow-Effect on the ItemsPanel. How can I disable it or completely remove all Bitmap Effects on the ComboBoxes and its children? ...

WPF DataBinding: Grid ColumnDefinition Width to UserControl DependencyProperty

I'm not sure what I'm doing wrong, but I am attempting to align my user control with the ColumnWidth of my grid using DataBinding and DependencyProperties. I have a GridView on my Form Page which contains a two instances of a user control (Address). The address usercontrol contains a textlabel "header" so that I can name the user contro...