xaml

WPF: Setting the text alignment of a GridViewColumn

By default, text is centered in the headers of a ListView (not in the content cells!), I've been struggling to make it left aligned, here's what I've come up with: <ListView.Resources> <DataTemplate x:Key="Templ"> <TextBlock HorizontalAlignment="Left" Text="{Binding}"/> </DataTemplate> </ListView.Resources> ... <GridVi...

Is it possible to use XAML for my own ideas / framework?

Do you know if it would be possible to create a framework myself in C# that utilizes the good things that XAML offers, such as dependency properties and data binding? Or would I have to create everything from scratch myself? ...

XAML StoryBoard StackPanel

Hi, I am trying to add a storyBoard to my stack panel and bind the trigger to a code behind property, but the stackpanel is not responding to the property changes. here is the code: <Window x:Class="DirectAccess.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microso...

How do I populate XAML Listbox Items from a method that requires a single argument?

So I have a Listbox: <ListBox Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"> //<----Item's Data Source Method Call Here? <ListBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="true" /> </ItemsPanelTemplate> </ListBox.ItemsPan...

Can't bind value to combobox in wpf

I have a control,where is combox. I bind to it properties from modelview. I can bind properties to textboxes, but not to combobox. Value from modelview is 4. Anyone know why is that ? <ComboBox HorizontalAlignment="Left" VerticalAlignment="Top" SelectedItem="{Binding Path=QuantityOfStars}"> <ComboB...

Rich WPF FocusVisualStyle.

Does anyone have a rich FocusVisualStyle to share? I am looking for something like the Silverlight 4 one or Google TextBoxes in Chrome or like Visual Studio 2010. Examples: ...

How to use "{" symbol in xaml string

How can I use { symbol in xaml string? E.g.: <TextBlock Text="{0}"/> I can do it starting string with a space symbol: <TextBlock Text=" {0}"/> but I'm looking for a better solution. ...

How to show XAML inside a Tab Control in Silverlight 4

Basically what I am asking here is how to display a XAML page within a tab control that is part of another XAML page. Or, for that matter, if this is even possible. I want to be able to click a button on page1 and be able to view the page2 from within a tab control that is on page1. Would this be something to be handled within a Fra...

WPF layout for autosize textblock and icon floating on the right - how?

I am trying to get a layout where an icon floats on the right end of a textblock; the textblock grows/shrinks to content. I cannot make this happen without the textblock running outside the grid. For example: <Grid x:Name="LayoutRoot" Width="500" HorizontalAlignment="Left" ShowGridLines="True" > <Grid.ColumnDefinitions> <ColumnDefini...

How to change state of container items based on container state (WPF/XAML)

I have a Listbox with items created through databinding. The item template creates a custom view for each generated item. Each generated item view is its own user control. I'd like to change the state of the listbox to something like "Details" vs. "Compact" and have each item have its own state changed automatically. The view item kn...

Programmatically reference items rendered by ItemsControl from code behind

I have a Silverlight user control that contains an ItemsControl that renders a StackPanel containing another user control for each item in the data source, the XAML is as follows: <Grid x:Name="LayoutRoot"> <ItemsControl ItemsSource="{Binding}" x:Name="ValuesItemSource"> <ItemsControl.ItemsPanel> <ItemsPanelTempl...

allowing clicks on Button in ComboBoxItem when IsHitTestVisible is false

Setting the IsHitTestVisible="false" has the effect of having the whole ComboBox's drop area unresponsive to clicks. The same goes for setting to true. With a ComboBox I don't have to create any storyboard to make ComboBox animation like but I found this issue. How can one make the ComboBoxItem area unclickable except for the button ...

Problem displaying new image resource in Silverlight 4 app

Hi, I have a Silverlight application that I am working on. I have a few different custom button styles that use a ContentTemplate to display an Image as a Button, such as: <Style x:Key="CancelButtonStyle" TargetType="Button"> <Setter Property="Cursor" Value="Hand"/> <Setter Property="Template"> <Setter.Value> ...

Add Ellipse Position within Canvas

Hi all, I have an ellipse that I'd like to programatically put into a canvas. Unfortunately, the ellipse only draws in the top right. Any help? SolidColorBrush newColor = HotSquare(col); Color newCol = getCol(col); Color newCol2 = getCol2(col); Ellipse el1 = new Ellipse(); el1.Height = 40; el1.W...

Replace HTML with XAML

Has anyone ever tried this? And I don't mean sending XAML to the browser but using XAML to build an ASP.NET control tree or something similar which then renders as HTML. XAML is intresting, HTML hasn't changed much and to my knowledge HTML5 is mostly more of the same. ...

How to render a usercontrol loaded via LoadComponent to a bitmap/image in WPF?

I'm trying something along these lines. //Somewhere in my app System.Uri resourceLocater = new System.Uri("/MyApp;component/Users.xaml", System.UriKind.Relative); var obj = Application.LoadComponent(resourceLocater); //Invoke the renderxaml element var image=RenderXamlElement(obj as UserControl); //Then I may save this image to a fil...

How can I update my Visual Studio solution so that it uses WPF 4.0?

Hello everyone, I recently converted my solution from Visual Studio 2008 to 2010, hoping I would be able to use WPF 4.0's SelectionBrush property. I try to access this property in the XAML for my project as follows: <TextBox SelectionBrush="Aqua"/> Disappointingly, It underlines my code and says: The property 'SelectionBrush' was no...

Binding ListBox items to a local property and formatting items with bindings

I'm trying to understand binding to local items using XAML. I'll make this a two part question, but both deal with the same basic situation: Say I have a custom user control called MySelector MySelector includes a ListBox called listBox1 MySelector includes a List<string> property called TextList TextList is a read-only property t...

VS2010 takes 5 seconds to simply open any XAML files (!)

Visual Studio 2010 - release - takes about 5 seconds to open a xaml file. It does it on some machine, not all of them! .cs files open instantly. It only happens to XAML. We tried the following, unsuccessful: Run VS as Administrator import user settings from a machine that didn't have the problem clear the borked registry using cclea...

How to create &larr; in XAML

How to create &larr; (←) in XAML? I want to create backspace button. ...