xaml

Nested TextBlocks and Hyperlinks, How do you replicate this XAML in C#?

I have this XAML: <TextBlock TextWrapping="Wrap" Foreground="Green" Text="This is some Green text up front. "> <TextBlock Foreground="Blue"> This is some Blue text. </TextBlock> This is some Green text following the Blue text. <Hyperlink> <TextBlock Text="And finally, this is a Hyperlink." Tex...

How do I make WPF ListView items repeat horizontally AND vertically?

Hi, I have a listview where I would like to display things horizontally. That works fine, but now I would need to have them display like in a Windows Explorer type. For example : A B C D E F G H I or A B C D E F G H I Is it possible in a listview? ...

WPF Grid Mouse Events

I was wondering, what is the best way to capture a mouse Event inside of a wpf grid? I wanted to Capture an event when the mouse wheel is either scrolled up or down in the grid. I tried to create a custom grid, but that kind of didn't work. Any ideas? ...

wpf to silverlight xaml issue

Ok, I have a ResourceDictionary definition that I used for a WPF app below: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Style x:Key="fieldsPanel" TargetType="{x:Type StackPanel}"> <Style.Resources> <Style TargetType="{x:Type CheckB...

Updating DataTrigger manually or run synchroniously

Hello, I hope you can help me, I have a problem with WPF DataBinding in a FlowDocument. Here's a short description what I want to do: My aim is to print or export a XPS-Document which is build from a FlowDocument. In the FlowDocument I set some XML-Bindings which should represent the content of the XMLNode. In my XMLSource i'm storing v...

How to enable ribbon menu?

<r:RibbonWindow.Resources> <ResourceDictionary> <!--Ribbon Commands--> <r:RibbonCommand x:Key="cmdPrint" CanExecute="RibbonCommand_CanExecute_Print" LabelTitle="Print" LabelDescription="Print" ToolTipTitle="Help" ToolTipDescription="This is used to Print" SmallImageSource="Images\printIcon.png" LargeImageSource="Imag...

Triggering on a ScrollViewer's scroll bar visibility (WPF)

Is it possible to create a Trigger that is triggered based on a ScrollViewer's scroll bar visibility? I have a ScrollViewer with its VerticalScrollBarVisibility set to Auto and I want to change some of the ScrollViewer's properties only when the scroll bar is actually visible. Something like this: <ScrollViewer VerticalScrollBarVisibil...

WPF, xaml Cad or drawing app examples?

I am trying to learn WPF and xaml and am writing a cad style geometry app for my kids. Does anyone know of an existing example written in VB.net? C# is fine as well. Thanks! EDIT: Any thoughts/examples on how to structure such an app? TIA ...

ComboBoxItem to full width of ComboBox, when using SelectedIndex, or navigating keyboard?

Following XAML causes the "My stuff" being centered of ComboBox until I open the ComboBox, when it correctly stretches itself. <ComboBox Height="30" Width="300" HorizontalContentAlignment="Stretch" SelectedIndex="0"> <ComboBoxItem HorizontalContentAlignment="Stretch"> <Border Background="Red"> <Te...

How do I make an asterisk line up with surrounding text in WPF?

I'm trying to make an asterisk line up vertically with surrounding text/graphics rather than above it. I thought applying a negative BaselineOffset would be the solution, but it seems to have no effect. Here's the documentation for the TextBlock.BaselineOffset property: Property Value Type: System.Double The amount by which ...

Designing with Blend but loading styles at runtime

I have a large WPF application and am trying to use Blend 3 to speed up my UI design on some portions of it. The problem I run into is that I have different skins that the user can use, so I load the ResourceDictionaries and Converters at runtime at the Application level. Because of this, when I open a .xaml file in Blend, it can't f...

WPF ScrollView resize offset problem

I have the following test sample <Window x:Class="WpfScrollTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="200" Width="200"> <Border> <StackPanel> <Label Width="Auto" Height="Auto" Content="...

Does anyone have a simple example of a UserControl with a single ContentPresenter?

So far, I have this: <UserControl x:Class="MyConcept.ExpanderPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Border Style="{StaticResource Border_PanelStyle}" CornerRadius="3" /> <ContentPre...

TreeView items disappear

I have a TreeView that is generated in code, and will look like this in the end: <TreeView> <TreeViewItem Header="X"> <TreeViewItem Header="Y"> <TreeViewItem Header="Z"> <StackPanel Orientation="Horizontal"> <TextBlock Width="100" Text="SomeText" /><TextBox Width="100" Text="TextInBox" /> </StackPan...

Get data from selected row in Gridview in C#, WPF

Hi, I am trying to retrieve data from a Gridview that I have created in XAML. <ListView Name="chartListView" selectionChanged="chartListView_SelectionChanged"> <ListView.View> <GridView> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" Width="250"/> <GridViewColumn Header="Type" DisplayMemberB...

WPF: Execute a Command Binding in a search field when pressing the enter button

I have a search field in my WPF app with a search button that contains a command binding. This works great, but how can i use the same command binding for the text field when pressing enter on the keyboard? The examples I have seen are all using the Code behind with a KeyDown Event Handler. Is there a smart way to make this work only wit...

App.xaml style cannot be used in Usercontrol, how come?

I have a style for a textblock that is set inside my app.xaml this is then applied to textblocked through out my application and works fine. However i get an error: "could not create instance of type" if i apply this style to a textblock within my user control, how come this is a problem? <UserControl x:Class="Client.Usercontrols.MyBut...

Applying a style to all derived classes in WPF

I want to apply a style to all classes derived from Control. Is this possible with WPF? The following example does not work. I want the Label, TextBox and Button to have a Margin of 4. <Window x:Class="WeatherInfo.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/wi...

Dependency property not working, trying to set through style setter.

I am trying to set up a custom style for my newly made usercontrol, however i am getting the error : "Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'." I thought i had set up Dependency properties but it seemed this was not the case, so i did some research and added: public stat...

How can I set selected value of a XAML Combobox?

Why in the following example is the combobox set to blank instead of "Mr."? XAML: <Window x:Class="TestComb82822.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel HorizontalAlignment="Lef...