xaml

Binding a TreeView with ContextMenu in Xaml

I'm pretty new to Xaml and need some advise. A TreeView should be bound to a hierarchical object structure. The TreeView should have a context menu, which is specific for each object type. I've tried the following: <TreeView> <TreeView.Resources> <DataTemplate x:Key="RoomTemplate"> <TreeViewItem Header="{Binding Name}"> ...

How do I get the XAML compiler to use textual content property on custom classes?

Given a simple C# class definition like: [System.Windows.Markup.ContentProperty("PropertyOne")] public class SimpleBase { public string PropertyOne { get; set; } public string PropertyTwo { get; set; } } why is it not possible to omit the sys:string tags around the word Test in the xaml below. <custom:...

Sorting Listbox in Silverlight (Sketchflow)

I have a Listbox with multiple columns and bound to a data source (XML) as shown below. <ListBox x:Name="lstBox1" Background="#FFC5EFFD" Margin="7,50,10,15" ItemTemplate="{StaticResource ItemsPanelTemplate1}" ItemsSource="{Binding BPICollection}" BorderThickness="0"/> I'm trying to figure out how to sort a particular column in the li...

How to add a menu item in a xaml file

Hi there.. I am new in silverlight .. unlike windows form ,I am unable to find menu item in silverlight . How to add menu item in xaml file. I have to do this Thanks ...

C# WPF XAML Problem with icon in GridViewColumn

I've created a ListView with a GridView component in it. Now trying to fill one of the cells with an icon (PNG) like in the code sample below (save_icon.png): <ListView.View> <GridView> <GridViewColumn Header="Date" Width="Auto" DisplayMemberBinding="{Binding Date}" /> <GridViewColumn Header="Time" Width="Auto" Displ...

Pass value from another page to MainPage.xaml in Silverlight when using Navigation?

I have a Page in Silverlight which is Navigated from the MainPage.xaml, called OpenPage.xaml, I then want to pass a value back to the MainPage.xaml - this OpenPage.xaml is called using this: NavigationService.Navigate(new Uri("/OpenPage.xaml", UriKind.Relative)); From the mainpage - this is not a child of the MainPage as the RootVisua...

How to animate CornerRadius property with four distinct values - "0,0,0,0" to "0,0,10,10" ?

Hi all I have to transition the CornerRadius property of a Border from value "0,0,0,0" to value "0,0,10,10" via an animation. This must be done directly in the XAML file w/o using code behind other than a ValueConverter or similar. I think CornerRadius is animatable using an ObjectAnimationUsingKeyFrames - but how to animate just two o...

Animated Ellipse

Hi, i need someone to help me. I need a xaml with animated ellipses like the ones shown here:http://www.telerik.com/products/silverlight/chart.aspx They are to act as hotspot indicators on my map. What i have below is a xaml that i was trying to do but the circles don't center and have no fed-in/fade-out effect. May somebody help me ple...

How do I use a code behind property in a trigger to change a control property?

Hi, I am trying to do a fairly simple thing in my WPF application, or at least I think it's simple. I have a Window that contains an int property in the code behind. Let's call this one IntProperty. The Window implements the INotifyPropertyChanged interface and IntProperty fires the notification on change. It looks like this: ...

Trouble displaying an object in WPF

I'm so new to this that I can't even phrase the question right... Anyway, I'm trying to do something very simple and have been unable to figure it out. I have the following class: public class Day : Control, INotifyPropertyChanged { public static readonly DependencyProperty DateProperty = DependencyProperty.Register("Date"...

XamlReader.Parse throws exception on empty String

In our app, we need to save properties of objects to the same database table regardless of the type of object, in the form of propertyName, propertyValue, propertyType. We decided to use XamlWriter to save all of the given object's properties. We then use XamlReader to load up the XAML that was created, and turn it back into the value ...

New TabItem Content ActualHeight crashes Xaml Window

I am able to create new TabItems with Content dynamically to a new window by streaming the Xaml with XamlReader: NewWindow newWindow = new NewWindow(); newWindow.Show(); TabControl myTabCntrol = newWindow.FindName("GBtabControl") as TabControl; StringReader stringReader = new StringReader(XamlGrid); XmlReader xmlReader =...

TreeView binding issue in WPF

Consider the following data structure: List<Person> People; class Person { List<Car> Cars; List<Hobby> Hobbies; } I want to bind a TreeView to this structure. And it should look like this: People > Frank > Cars > BMW > Ford > Hobbies > Tennis > Golf > Jane > Cars > Hobbies How can this be achieved in X...

Using Image Source with big images in WPF

I am working on an application that allows users to manipulate multiple images by using ItemsControl. I started running some tests and found that the app has problems displaying some big images - ie. it did not work with the high resolution (21600x10800), 20MB images from http://earthobservatory.nasa.gov/Features/BlueMarble/BlueMarble_mo...

Fireworks Display in WPF

I am trying to draw a fireworks affect in WPF XAML and was wondering what would be the best way to approach this? ...

Does Adorner breaks MVVM?

I'm developing a WPF app using MVVM. Most of my views have only xaml markup and nothing (except default boilerplate) on code behind. All except one view that I use adorners to "blacken" the screen when I want to make the whole screen disabled. private void Window_Loaded(object sender, RoutedEventArgs e) { //todo: transf...

In XAML is there way to bind key press and key release to specific commands?

In my application I have keys that bound to commands using the KeyBinding class. The command is executed when the key is pressed and released. I have a special case where I want to bind separate commands to the pressed action and to the released action. For example when the space key is pressed I want my app to run a command to enter ...

Problem with DataTrigger binding - setters are not being called

I have a Command bound to a Button in XAML. When executed, the command changes a property value on the underlying DataContext. I would like the button's Content to reflect the new value of the property. This works*: <Button Command="{x:Static Member=local:MyCommands.TestCommand}" Content="{Binding Path=TestProperty, Mode=OneWay...

How to calculate full height of a scroll viewer

Hi, I am using a scroll viewer in my xaml page. When i display lot of entries in this viewer it starts showing a scroll bar which is fine and desirable. But while exporting that page in jpeg format i need to show all entries in one image. Hence i am planning to increase its size just enough to make scroll bar disappear. Chalange i am fac...

Is there a declarative way to force a set of Buttons to be the same size?

I'm writing a form in XAML that has multiple buttons with content of different sizes (ie "OK" and "Save As...") Ideally, I'd like them all to be the smallest size possible to hold the largest content. In the example above, both buttons would be the width necessary to hold "Save As..." plus the margins and padding. If they were Grid cell...