xaml

How can i get the real current height of a stackpanel?

Hallo, i want to make a custom stackpanel in WPF, which shall automatically resizes his childs to a certain size depending on the panels height. But the panels height is dynamic because it stretches to his parent. When i want to get the height (i tried all possibilities, see code), it is always 0 or not defined, although in the build so...

How to sort a Listview in a DataTemplate in XAML only?

I have a window with a TabControl that i've bind to a list of objec, I'll called MyItem : <TabControl Name="MyTabPNL" Background="Gainsboro" ItemsSource="{Binding MyItemList, ElementName=WatcherWindow}" ContentTemplate="{StaticResource tabItemTemplate}"> </TabControl> This MyItem class has an ObservableCollect...

Auto resizing wpf elements with scroll bars (Rich text box, list box) vb

Hey guys, I'm having a problem where I have elements such as Listboxes and Rich Text boxes that I want to set to size automatically in xaml according to the size of the window, but I only want it to resize to the size of the window and then put scrollbars if the content is any bigger than that. Unfortunately, the only way I can get scr...

Restrict Silverlight/WPF Behavior visibility

In Silverlight (and probably WPF), when I define a System.Windows.Interactivity.Behavior<T> for e.g. an ItemsControl, like public class SomeAwesomaticBehavior : Behavior<ItemsControl> { } it will appear in Visual Studio's XAML editor (and probably in the Designer too) even for ordinary, non-Items-Controls and throw nasty runtime excep...

Silverlight/WPF parenthetical value syntax in a Storyboard animation

Somehow in my WPF studies, this detail has escaped me. I've seen syntax of this sort: <UserControl.Resources> <Storyboard x:Name="myStoryboard"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" ... > ... Why is the StoryBoard.TargetProperty value surrounded by parentheses? What does that mea...

How to set/bind ScrollBar.Maximum the right way in XAML?

I have written a custom control MyControl with virtual content that is much wider than the control itself, and I want to make use of the ScrollBar-control to scroll the virtual content of my own control. My control has 3 properties, that are important in this scenario: Width: the physical width of the control VirtualWidth: the width of...

Sorting XAML tags in VS2010

Is there a way to sort XAML tags in Visual Studio 2010? For an example <Button Content="OK" Height="23" Margin="0,0,0,0" /> <Button Margin="0,30,0,0" Content="Cancel" Height="23" /> may be reordered to <Button Content="OK" Height="23" Margin="0,0,0,0" /> <Button Content="Cancel" Height="23" Margin="0,30,0,0" /> ...

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...

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...

silverlight drag image

Hi, I have a custom control and and want to be able to drag the images from the control onto another control on the page. I have mastered the drag but I cant drag the image outside the custom control. This is the code im using within the custom control bool isMouseCaptured; double mouseVerticalPosition; double mouseHor...

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> ...

Two-way databinding to POCO without INotifyPropertyChanged

How does two-way databinding work in Silverlight when the data source object's properties don't raise PropertyChanged events in their setters? For example, in code samples, I've seen databinding to instances of the System.Windows.Point struct, which does not implement INotifyPropertyChanged and is mutable. What happens (or should happen...

Want to add the selectedValue also in the xaml along with the selected Text in my wpf window.

I have a compbobox with the following information <ComboBox Margin="10,10,0,13" Name="ComboBox1" HorizontalAlignment="Left" VerticalAlignment="Top" Width="128" Height="21"> <ComboBoxItem Content="All " ></ComboBoxItem> <ComboBoxItem Content="Printed"></ComboBoxItem> <ComboBoxItem Content="Unprinted"></ComboBoxItem> ...

Binding to a collection of user controls in XAML

I've a collection of UserControls which I want to show in a stack panel. I've no control over how and what those user controls contain. I just know that they are some sort of user controls (could be a button, a textblock or any UIElement.) Here is a small example public class Car : IHasView { public UserControl MyView { get return ...

WPFToolkit Charting - How to remove markers or change marker size?

Hi, I can't quite see how to remove the markers in a WPFToolkit graph. I can see they are the ellipses in the XAML below, but I can't seem to successfully change any of the parameters to get the size of them to change, OR to remove them. Any ideas? Here is the XAML (which stills need the WPFToolkit) I've been using as a test. <Windo...

Problem with animated GIF in WPF

Hello I try to show animated GIFs in WPF application using custom classes found at http://stackoverflow.com/questions/210922/how-do-i-get-an-animated-gif-to-work-in-wpf First I used AnimatedImage class, after that - GifImage class. Both classes failed during animation initialization (while resoving Uri to the GIF file, saved as app. res...

All Frames with different Uris navigated to first created Frame

I create multiple Frame programmatically and navigate each Frame to different page, But all of Frames navigate to the Uri of first created Frame while the Uri is different. EDIT : In my project user can open some items from his inbox list and view each item's page in different tab(each tab include a Frame). If this is not possible, i...

Why Visual states do not work ?

I'm trying to create animatable control but it seems animation does not works. What happened with VisualStateManager ? <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="loginStates"> <VisualState x:Name="ready"> <Storyboard> <ObjectAnimationUsingKeyFrames BeginTime="...

working with datagrid having 3 radio buttons on same row (in C#)

WPF visual studio 2010 C# how can I perform these tasks.(XAML or code behind) I have three columns on the same row of the datagrid,each column contains a radio button named none,read,write. there is a DEFAULT rule: the write(radio) must be ON when the other two are OFF. when I turn ON one the other two should turn OFF then if I turn...

WPF: How do I access the rendered dimensions of a Path in XAML?

I am trying to overlay text content on top of a region described by a Path. The Path is in a Viewbox wrapped Canvas so that it can scale to any size. The TextBlock is in a Canvas wrapped Grid that is trying to use the Path dimensions to determine the placement of the text block. <?xml version="1.0" encoding="UTF-8"?> <Canvas xmlns="...