|
Hey all,
Can someone tell me if WPF .NET 3.5 apps are compatible on Windows CE 6.0? I tried looking at a lot of places and still haven't found a definitive answer to this. You'd think that both being Microsoft technologies it would be obviously supported but I can't seem to find a set response for the question.
Thanks,
kiranpmody
|
|
|
|
|
No they aren't. The CE framework lacks a lot (such as DirectX support) that WPF is built upon.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
thanks for the prompt reply..
|
|
|
|
|
Hi,
I'm a newbie in wpf and I have a problem with the binding.
I have a class inherited from FramworkElement and there is a Collection. The Items of this collection are inherited from DependencyObject.
On the Form is only one TextBox. I want that the text, which is typed by the user will be copied into the first Item of the collection.
Here some code
public class Item: DependencyObject
{
public string Name { get; set; }
public virtual object Value {
get { return GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
#region DependenvyProperty
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(object), typeof(Item));
#endregion
}
public class ItemContainer : FrameworkElement
{
private List<Item> _itemlist = new List<Item>();
public List<Item> ItemList
{
get { return _itemlist; }
}
}
and the form:
Window x:Class="WpfApplication2.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="417" Width="589" xmlns:my="clr-namespace:WpfApplication2">
<Grid>
<my:ItemContainer Height="18" HorizontalAlignment="Left" Margin="-168,0,0,33" x:Name="itemContainer1" VerticalAlignment="Bottom" Width="18">
<my:ItemContainer.ItemList>
<my:Item Name="Item1" Value="{Binding ElementName=txtItem1, Path=Text}" />
<my:Item Name="Item2" />
</my:ItemContainer.ItemList>
</my:ItemContainer>
<Canvas Margin="16,18,8,6" Name="canvas1">
<TextBox Canvas.Left="88" Canvas.Top="15" Height="23" Name="txtitem1" Width="89" />
<Label Canvas.Left="14" Canvas.Top="16" Height="22" Name="label1" Width="58">Item1
</Label>
</Canvas>
</Grid>
</Window>
At runtime the program displays the error2 Cannot find governing FrameworkElement or FrameworkContentElement.
I don't want to inherit item from FrameworkelElement because in the real project the class Item is inherited from another class.
What can I do to transfer the text from the textbox to the first item of the collection ?
Thanks in Advance
Willibert Stofel
|
|
|
|
|
Hi,
I currently would like to compare several test systems running WinXP and Win7 with different graphics hardware (onboard, dedicated, etc.), and therefor need some kind of WPF Benchmark application. I don't have a focus on specific WPF features at the moment, I just want to gain a general impression how each of these systems perform, i.e. how many "frames per second" they produce using different WPF GUIs.
Are there any benchmarking programs available? Which do you recommend?
Thanks alot.
modified on Monday, August 2, 2010 9:19 AM
|
|
|
|
|
Hi, All!
I'm having another major trouble. I have developed a control, that has some properties, but once I set binding to these properties, a strange error occures during the build. Visual Studio highlights an irrelevant string from the xaml code with green color.
here is a code sample which throws that error:
<a:SearchControl x:Name="SearchResult" SearchCriteria="{Binding ElementName=SearchCriteria, Path=Criteria}"/>
Note 2 things:
1) Code below builds fine
<a:SearchControl x:Name="SearchResult"/>
2) In an output window of VS, it is stated, that System.Unimplemented exception occurred in PresentationFramework.dll. Usually, such exception means, that requested method is not implemented, which is kinda odd, because this property is indeed implemented.
|
|
|
|
|
hello
I'm using sample from WPF Modal Dialog[^] to popup my WPF Modal dialog, problem is, the modal dialog is not movable, how may I correct this?
Here's code to embed the popup
<br />
<Popup<br />
Name="MyMessageModal" <br />
Placement="Top"<br />
PlacementTarget="{Binding ElementName=SomeFormElement}"<br />
Width="100px" <br />
Height="100px" <br />
IsOpen="False"<br />
StaysOpen="true" <br />
AllowsTransparency="True"<br />
Visibility="Collapsed"<br />
><br />
<StackPanel><br />
<myctrl:MyMessageDialog x:Name="SomeEmbedMsgCtrl" ></myctrl:MyMessageDialog><br />
</StackPanel><br />
</Popup><br />
And to actually show it,
<br />
MyMessageModal.IsOpen=true;<br />
MyMessageModal.Visibility = Visibility.Visible;<br />
Thanks
dev
|
|
|
|
|
You could write your own code on the mouse up, mouse down and mouse move event of the popup.
Perform lienar transforms as the user drags the mouse holding the top part of the popup.
|
|
|
|
|
Great thansk I got it working!
dev
|
|
|
|
|
I'm using VS2010 and SL4. I have the following XAML, and I'm trying to implement visual state management, but it appears I don't understand how it works.
<Border CornerRadius="8" BorderBrush="Black" BorderThickness="1" Background="SlateBlue"
Height="35" HorizontalAlignment="Stretch" VerticalAlignment="Top">
<ItemsControl x:Name="myItems" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Background="Transparent"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="States">
<VisualState x:Name="MouseOver">
<Storyboard >
<ColorAnimation Storyboard.TargetName="itemBorder"
Duration="0:0:1" To="Yellow"
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"/>
<ColorAnimation Storyboard.TargetName="itemContent"
Duration="0:0:1" To="Black"
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal">
<Storyboard >
<ColorAnimation Storyboard.TargetName="itemBorder" Duration="0:0:1"
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"/>
<ColorAnimation Storyboard.TargetName="itemContent" Duration="0:0:1"
Storyboard.TargetProperty="(TextBlock.Foreground).(SolidColorBrush.Color)"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="itemBorder" Background="Transparent" Margin="5,0,0,0">
<Border.RenderTransform>
<CompositeTransform/>
</Border.RenderTransform>
<TextBlock x:Name="itemContent" Text="{Binding}"
FontSize="13" Padding="0" Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="White" />
</Border>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.Items>
<core:String>Item 1</core:String>
<core:String>Item 2</core:String>
<core:String>Item 3</core:String>
<core:String>Item 4</core:String>
</ItemsControl.Items>
</ItemsControl>
</Border>
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
In this code, AFAIK, when you move your mouse over the ItemsControl , the background of the itemBorder (Border) changes to Yellow and itemContent (TextBox) foreground changes to Black. Both color change again when the state moves back to normal.
|
|
|
|
|
That's what I *want* to happen, but it's not happening.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
After some searching I found this[^] - apparently the datatemplate does not support the VisualStateManager . There is a workaround as given on this website.
Best of luck!
|
|
|
|
|
I have a grid defined as
<Grid x:Name="CoordWPanel" Height="38" Margin="10,0,70,10" VerticalAlignment="Bottom"
Background="#77000000" HorizontalAlignment="Left">
I want the background shade to cover the the bottom of the screen (less the margin area). But it always stops at the last control placed in the grid. The shading only goes halfway across the screen because that's how far the controls in the grid go. How can I get the grid to fill out the rest of the area in the margins?
Thanks.
Brent
|
|
|
|
|
Nevermind - HorizontalAlignment="Stretch" Duh
Brent
|
|
|
|
|
I was typing my reply when you sent yours. My apologies.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
No big deal, I just had one of those bonehead moments when I realize it must be time to go home.
Brent
|
|
|
|
|
You don't have a width specified so the Grid will shrink to be as small as possible, i.e. just wide enough to hold your controls. And it will pin itself into the bottom left corner. Your right/top margins will only be used if the controls are big enough to fill the width/height of your window.
Change HorizontalAlignment="Left" to HorizontalAlignment="Stretch" (or delete the assignment all together, stretch is the default). The grid will take up as much room as possible leaving the margins specified on each side.
Depending on how you want your controls contained to look, you might want to put a StackPanel in the Grid to hold the controls or switch the Grid to a DockPanel and dock your controls to the bottom.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
I have a settings page that I want to hide certain settings unless it has been unlocked by a password by someone authorized to make the changes.
Right now what I have:
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Unlocked, Converter={StaticResource ResourceKey=BooleanVisibility}}"
Which works fine. However, it seems extremely time consuming to type that in for every control, even doing copy and paste.
I tried:
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanVisibility" />
<Binding x:Key="LockedProperty" RelativeSource="{RelativeSource AncestorType={x:Type Window}}" Path="Unlocked" Converter="{StaticResource ResourceKey=BooleanVisibility}" />
</UserControl.Resources></pre
And the Visibility of the control set to:
<pre>Visibility="{StaticResource ResourceKey=LockedProperty}"
Which complains that "A 'Binding' cannot be set on the 'Value' property of type 'DictionaryEntry'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject." Which makes sense now that I'm reading it again. It thinks I'm trying to bind UserControl.Resources.
Is there any way to make a binding template or resource that would let me make the binding call a lot simpler?
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
See RelativeSource actually tries to find the window element just by traversing through the entire visual tree. So I recommend to use ElementName rather than an Ancestor.
Use x:Name for the Window and use
Visibility = {Binding ElementName=win, Path=Unlocked, Converter={StaticResource BooleanVisibility}}
Actually this will make the binding to avoid traversing through the Visual Tree.
Abhishek Sur
Don't forget to click "Good Answer" if you like this Solution. Visit My Website-->www.abhisheksur.com
|
|
|
|
|
I am tring to bind a xaml element property to a property defined in the class.
I've tried the following:
public class FMChartMS
{
private double setting = 275;
public double MyProperty { get { return setting; } }
}
<my:FMChartMS x:Name="ChartPage">
<Grid Height="{Binding MyProperty, ElementName=ChartPage}" />
It crashes the app. What am I missing?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
You need to make a DependencyProperty for MyProperty.
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(double), typeof(FMChartMS), new PropertyMetadata(false));
public double MyProperty
{
get { return (double)this.GetValue(MyPropertyProperty); }
set { this.SetValue(MyProperty Property, value); }
}
I'm using the standard notation for naming dependency properties, PropertyNameProperty. That's why it's called MyPropertyProperty when using your example. In my project I have a property called Unlock with the dependency property called UnlockProperty. I like to declare the DependencyProperty first so IntelliSense will help fill in the blanks.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
That didn't work.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Sorry, there was a copy/paste error.
DependencyProperty.Register("MyProperty", typeof(double), typeof(FMChartMS), new PropertyMetadata(false));
should be
DependencyProperty.Register("MyProperty", typeof(double), typeof(FMChartMS), new PropertyMetadata(0d));
The "0d" is the initial value of the property. You can set it to whatever you want.
Warning: The "d" is very important. For some reason the PropertyMetadata constructor does not implicitly convert values passed into, so even though you can use double var = 0; in code, new PropertyMetadata(0) will cause your program to fail just the same as it is now with being passed a boolean. It has to be passed a value of the same type being declared.
Brad
Deja Moo - When you feel like you've heard the same bull before.
|
|
|
|
|
How do we change theme for a silverlight application at run-time. Suppose I have "Theme1.xaml", "Theme2.xaml" and "Theme3.xaml" as themes inside 'Themes' folder, and I wish to apply them on button-click or combobox-selection.
In WPF, I used to get the required result with following code -
ResourceDictionary skin = new ResourceDictionary();
skin.Source = new Uri(@"Themes/" + themeName + ".xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(skin);
But for Silverlight, I'm not sure how to do it. Any idea? Please do not provide link with 'Telerik' content. I have seen it already.
|
|
|
|