|
Thanks. That wouldn't explain why some of the controls (grid, some buttons) don't show up at all though, would it?
|
|
|
|
|
To be honest, I can't really remember all the details - just the fact that a screen went semitransparent on XP for no apparent reason.
|
|
|
|
|
Hi,
I want to create a WPF user control to display an image at runtime.
I want the image size are adapted to those of control.Come can I do this?
PS: Sorry my English.
|
|
|
|
|
|
I’ve just published XAML Power Toys 4.0 here:
http://karlshifflett.wordpress.com/2009/02/10/xaml-power-toys-40-released-code-name-mvvm/[^]
New Features
• Extract properties to a Style allows selecting a control, choosing desired properties and have those selected properties extracted to a newly created style
• Create ViewModel Class from a VB.NET or C# code window. Easily create a ViewModel stub that includes commands and exposed data class.
• Group into GroupBox
• Option to generate x:Name for controls
• Option to add ForeReRead converter to TextBox bindings (both VB.NET & C# converters included in source and binary downloads. Converter is also included in the OceanFramework.WPF namespace.)
• Option to add TargetNullValue to TextBox.Text bindings when Source property is Nullable
• Corrected secondary application domain load issue reported by DevExpress. This fix also solves another edge case secondary application domain load issue.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I’ve just published XAML Power Toys 4.0 here:
http://karlshifflett.wordpress.com/2009/02/10/xaml-power-toys-40-released-code-name-mvvm/[^]
New Features
• Extract properties to a Style allows selecting a control, choosing desired properties and have those selected properties extracted to a newly created style
• Create ViewModel Class from a VB.NET or C# code window. Easily create a ViewModel stub that includes commands and exposed data class.
• Group into GroupBox
• Option to generate x:Name for controls
• Option to add ForeReRead converter to TextBox bindings (both VB.NET & C# converters included in source and binary downloads. Converter is also included in the OceanFramework.WPF namespace.)
• Option to add TargetNullValue to TextBox.Text bindings when Source property is Nullable
• Corrected secondary application domain load issue reported by DevExpress. This fix also solves another edge case secondary application domain load issue.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Great job Karl. This is fantastic news - you are THE man.
|
|
|
|
|
I am writing a WPF app, and want to have the app minimise to the system tray, the only examples of how to do this involve adding a reference to System.Window.Forms, is adding this reference bad practice or accepted as needed to be done to get some functionality.
Thanks
Mark
|
|
|
|
|
I see no reason to treat this as a bad practice. I have done this exact thing once, and I reference Windows.Forms all the time to get the File Dialogs (I just like the old ones better).
|
|
|
|
|
Hi,
I want to asssociate a BitMap image with the ListboxItems in a WPF Listbox. But I could not find any property in the ListboxItem which can get associated with an image. I am loading the ListBox programatically and want to display images on the listboxitems dynamically.
Could anyone let me know how can i acheive this in the WPF ListBox?
Thanx in advance.
|
|
|
|
|
I would be tempted to do something like this:
<DataTemplate x:Key="MyTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Grid.Column=1 Width="{Binding myImage.Width}" Height="{Binding myImage.Height}" Source="{Binding myImage}" />
<TextBlock Width="Auto" Grid.Column="1"
Text="{Binding MyTextItem}" />
</Grid>
</DataTemplate> Then, your listbox would look like this:
<ListBox Padding="3" HorizontalAlignment="Left" Width="Auto"
ItemTemplate="{DynamicResource MyTemplate}"
ItemsSource="{Binding Mode=Default, Source={StaticResource MyDataSource}}"
VerticalAlignment="Top" Height="Auto"/>
|
|
|
|
|
Hi Pete,
Thanx for the reply.
My actual requirement is to load the listbox with ToolboxItems. Each ToolboxItem has its own image which i want to associate with the listboxitem when i create a new listboxitem. I tried multiple ways of doing it programatically but unable to get the desired result.
Without using the xaml file how can i add items to the listbox programatically. One of the ways is setting the ItemsSource property to collection containing the items. I could populate a Treeview just by creating new TreeviewItems in the code and adding them to the Treeview.But the same did not happen incase of Listbox, am I missing anything?
Also, I am unable to group items within the listbox, could you please suggest how i can acheive this?
Thanx in adv.
|
|
|
|
|
Hi,
Also, using the DataTemplate given above I am not able to view any image on the Listboxitem. And sometime a XamlParseException is thrown at runtime, which is as follows
connot convert string in attribute 'Source' to object of type 'System.Windows.Media.ImageSource'
Any idea what am I missing? Is it that I cannot load a Bitmap image on the ListBoxItem??
|
|
|
|
|
I have a template and would like to access a UIElement. Because it is a template, it is not an object unless it is a static object. How can I create a static object in a template? The x:Name=”someName” are only to access inside template NOT outside. So we get an error when we try to access from a class. i.e. in constructor I can’t access someName. This also means that I cannot write a function when there is a change.
How this can be done?
Best regards
Agha
<Button x:Class="WpfApplication1.DoubleCharBtn"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Button.Template>
<ControlTemplate>
<Border x:Name="br" Background="Blue" CornerRadius="3" BorderBrush="Black">
<StackPanel Orientation="Vertical">
<TextBlock x:Name="TextUpperChar" HorizontalAlignment="Center" Text="{Binding UpperLetter}" />
<TextBlock x:Name="TextLowerChar" HorizontalAlignment="Center" Text="{Binding LowerLetter}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="Button.IsPressed" Value="True">
<Setter TargetName="br" Property="Background" Value="Red"/>
<Setter TargetName="TextUpperChar" Property="Background">
<Setter.Value>
<LinearGradientBrush>
<GradientStop Offset="1" Color="DarkBlue"/>
<GradientStop Offset="0.5" Color="Blue"/>
<GradientStop Offset="0" Color="DarkBlue"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
namespace WpfApplication1
{
/// <summary>
/// Interaction logic for DoubleCharBtn.xaml
/// </summary>
public partial class DoubleCharBtn : Button
{
internal static readonly DependencyProperty UpperCharProperty =
DependencyProperty.Register(
"UpperChar",
typeof(char),
typeof(DoubleCharBtn),
new FrameworkPropertyMetadata(' ', FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, UpperCharChanged));
public static void UpperCharChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
char TempChar = (char)e.NewValue;
DoubleCharBtn doubleCharBtn = (DoubleCharBtn)d;
// doubleCharBtn.TextUpperChar.Text = string.Format("{0}",TempChar);
}
public char UpperChar
{
set { SetValue(UpperCharProperty, value); }
get { return (char)GetValue(UpperCharProperty); }
}
internal static readonly DependencyProperty LowerCharProperty =
DependencyProperty.Register(
"LowerChar",
typeof(char),
typeof(DoubleCharBtn),
new FrameworkPropertyMetadata(' ', FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender, LowerCharChanged));
public static void LowerCharChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
char TempChar = (char)e.NewValue;
DoubleCharBtn doubleCharBtn = (DoubleCharBtn)d;
// doubleCharBtn.TextLowerChar.Text = string.Format("{0}", TempChar);
}
public char LowerChar
{
set { SetValue(LowerCharProperty, value); }
get { return (char)GetValue(LowerCharProperty); }
}
public DoubleCharBtn()
{
InitializeComponent();
}
}
}
|
|
|
|
|
|
Hi,
I try to leave my control as thay are in case i maximaize my window - but i always find them in disorder in my window.
this is the xaml code ...
<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextBox Name="Title" Text="Title" Background="Yellow" Width="Auto" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Height="30" VerticalAlignment="Top"/>
<ListView Name="RecentReport" Width="Auto" Height="180" VerticalAlignment="Center" HorizontalContentAlignment="Center" />
<StackPanel Height="52" Name="stackPanel1" Width="Auto" VerticalAlignment="Bottom" Background="Aqua" Orientation="Horizontal" />
</StackPanel>
|
|
|
|
|
Is this what you wanted?
<DockPanel LastChildFill="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TextBox DockPanel.Dock="Top" Name="Title" Text="Title" Background="Yellow" Height="30" />
<StackPanel DockPanel.Dock="Bottom" Height="52" Name="stackPanel1" Background="Aqua" Orientation="Horizontal" />
<ListView Name="RecentReport" />
</DockPanel>
|
|
|
|
|
Hi,
Does anybody know if VS2008 has an internal web browser, for launching Silverlight apps ? I believed have seen screenshots with that...
WolveFred
|
|
|
|
|
This one?
View/Other Windows/Web Browser (Ctrl-Alt-R)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No. I dont think VS 2008 has an internal web browser. not even in VS2010..
|
|
|
|
|
That's not true : there is one.
* Right click a page (.aspx, or on a folder)
* Select Browse With...
* Choose your browser : internal
* Click Set as Default
* Click Browse
|
|
|
|
|
Working through this... just completed part 3.
Accessing the ASP.NET Authentication, Profile and Role Service in Silverlight[^]
I can't get the images to appear in Firefox but I can in IE and Google Chrome - despite the fact that the latter is not "officially" supported. ???
Any ideas for things to tweak in Firefox?
Update: It now works as of this morning - no code changes. Must have been a caching issue.
Kevin
modified on Sunday, February 8, 2009 1:17 PM
|
|
|
|
|
It should work in Firefox as well.
Are you using that sample or did you change something in that sample?
|
|
|
|
|
It works now (tried again this morning) so must have been a caching problem.
Kevin
|
|
|
|
|
okay. Great!
|
|
|
|