We are loading some xaml for an Element at runtime (XamlReader.Load) for some preview purposes. Need less to say, the properties/bindings are not know as they can vary across elements/controls we are loading.
As the run time view model context is not available when we load the control for preview - after loading the Element, the idea i...
I have a WPF Window with a view model set as its DataContext, and have a ListBox with a DataTemplate and its ItemsSource bound to the view model, like in the following example:
View model:
using System.Collections.Generic;
namespace Example
{
class Member
{
public string Name { get; set; }
public int Age { get; set; }
}
...
My WPF App receives a stream of messages from a backend service that I need to display in the UI. These messages vary widely and I want to have different visual layout (string formats, colors, Fonts, icons, whatever etc.) for each message.
I was hoping to just be able to create an inline (Run, TextBlock, Italic etc) for each message ...
Hi,
I have a pixel perfect control layout for a form I want to create. I know the exact width, height and location of each control.
But I am finding it difficult to set it perfectly inside a Window element.
The Width and Height property of the Window is including the borders. How can I set the inner width and height of the window? The...
I'm trying to write a panel class from this two resources:
http://stackoverflow.com/questions/1871358/wpf-how-to-make-the-0-0-in-center-inside-a-canvas
http://www.codeproject.com/KB/WPF/DraggingElementsInCanvas.aspx
The panel class will have two attached properties "X" and "Y" and if any element gives x and y to be zero then it wil...
Hi, I got this sample:
XAML:
<Window x:Class="WpfApp_ListBoxTest.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">
<Grid>
<ListBox Name="lb" Margin="0,0,0,70"></ListBox>
<Button Height="23" Horiz...
What do I have to change to the following code so that the background is red, neither of the 2 ways I tried worked:
XAML:
<Window x:Class="TestBackground88238.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width...
Hey guys, Im working with wpf 3d, im currently writing a program that will create 3d tiles across the screen left to right, But i need to know what my bounds are on the X, Y i.e (-x-0) (0-x+) so I know when to start another row of tiles. My initial thoughts are trying to figure out a complex algorithm to go from pixels to screen coordina...
In my main Window1.xaml.cs, I build an ObservableCollection of ViewModels like this by instantiating with a LINQ-to-SQL model object:
using (var db = Datasource.GetContext())
{
var customers = from c in db.Customers
select c;
foreach (var customer in customers)
{
CustomerCollection.Add(new Custom...
My TextBlock has for example 50x50 pixels to display text, however if there is more text, I want a user to be able to scroll. Is there an autoscroll feature for this control?
Should I use a different control better suited for this task?
Here's a couple of pics to illustrate the problem:
This one works fine because the text fits in snu...
Would it be practical to create WPF applications without ever touching Visual Studio (or any other IDEs)? As in, coding and compiling completely within Vim and the command-line? What resources would you recommend for someone trying to do so?
...
Hi,
I've put off WPF development for a quite a while but, I'm finally thinking of moving ahead. I understand that WPF is totally new rendering "mechanism" which uses the GPU power (am I right?) unlike the CPU power that Winforms took up. If I'm not mistaking, this level of GPU support comes with Aero and therefore, a WPF app should run ...
Hello, I am trying to achieve something like the follwing:
This is a WPF Flow Document shown to
user.
This has been generated by user Richard Richardson at 01/01/01 23:15:00.
Blah blah blah (another 466 lines)...
End of message.
I want this date and the user name and 466 (and another gazillion literal texts) to come from Bi...
I have an Image control on my WPF Form. How can I create a border around it during runtime?
Here's my XAML code:
<Image Margin="2.5"
Grid.Column="1" Grid.Row="0"
x:Name="Behemoth" Source="Images/Hero/Behemoth.gif" Stretch="Fill"
MouseEnter="HeroMouseEnter"
MouseLeave="HeroMouseLeave"
MouseDow...
I want to do this in xaml with a trigger, how do I do it?
If ListBox1.SelectedIndex > -1 Then
Border1.Visibility = Windows.Visibility.Visible
Else
Border1.Visibility = Windows.Visibility.Hidden
End If
This XAML code does NOT work. 'SelectedIndex' member is not valid because it does not have a qualifying typ...
Hi
i am little stuck with adding new instances of a usercontrol in TabControl.ContentTemplate?
my Xaml is here
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate DataType="{x:Type uc:mytest1}">
<uc:mytest1>
...
I am developing a WPF desktop app for a small business. It will have a dashboard with 4 buttons that should show a corresponding window/form.
Examples -
Manage Entries
Admin
Reports
Help
Each of these has a separate form with lots of controls and stuff.
Is it best to have each of these as a separate window (including dashboard) an...
I've been recently playing with WPF and I've come across a number of problems that I can't solve. I have the following code in my generic.xaml:
<Style TargetType="{x:Type local:ClearButton}">
<Style.Resources>
<con:ValueConverter x:Key="converter" />
</Style.Resources>
<Setter Property="Width" Value="20" />
...
I want the top three items in my ListView to have special style. How can i achieve this?
I have tried this but item is always null:
if (tracklistQueue.Items.Count > 0) {
ListViewItem item = (ListViewItem)tracklistQueue.ItemContainerGenerator.ContainerFromIndex(0);
it...
Hi
I have a simple WPF with a menu, a toolbar and a ListView in a GridView. the menu and toolbar actions are bound to commands.
I have that defines when commands should be executed ("CanExecute"). Some commands, such as "Create New Item" should always be executed, so they are bound to a "e.CanExecute = true;" function.
However, when th...