|
It's not a path. I want to create a transparent rectangle, render text on it, and then rotate it. The reason for that is I need a better appearance than what Silverlight can produce if I programatically add rotated content.
.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
|
|
|
|
|
Do you have to do it in the client? If you can do it on the server, I'd just create a memory device context, and draw on that one.
|
|
|
|
|
Michel Godfroid wrote: Do you have to do it in the client?
That would be preferred, but it looks like it's impossible.
Michel Godfroid wrote: If you can do it on the server, I'd just create a memory device context, and draw on that one.
Yeah, I mentioned that in my edit. At this point, I have to decide whether I want to do it in our web service, or create an aspx page that does it in the code behind.
.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
|
|
|
|
|
|
See new message in this forum.
.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
|
|
|
|
|
I am trying to display an exception in a treeview with each innerexception being a child.
Here is what I have so far, but this only displays the exception.tostring() values.
<GridViewColumn Header="Exception" Width="Auto" DisplayMemberBinding="">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TreeView ItemsSource="{Binding Path=Exception}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type sys:Exception}"
ItemsSource="{Binding Path=InnerException}">
<TextBlock Text="{Binding Path=Message}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
Troy Zajac
|
|
|
|
|
I think the real problem with this method is that InnerException is not a collection. You may be able to use a converter to convert InnerException to an array of exception objects. However, there is a much easier method.
Here is a simple sample Window that does something similar to what I think you want.
XAML
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<DataTemplate DataType="{x:Type s:Exception}">
<Expander Margin="20,0,0,0" Header="{Binding Message}" Content="{Binding InnerException}"/>
</DataTemplate>
</Window.Resources>
<DockPanel>
<Button DockPanel.Dock="Bottom" Click="Button_Click">Error!</Button>
<ContentPresenter Name="Bob" />
</DockPanel>
</Window>
CODE (Pardon the VB)
Class MainWindow
Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
Try
a()
Catch ex As Exception
Me.Bob.Content = ex
End Try
End Sub
Private Sub a()
Try
b()
Catch ex As Exception
Throw New ArgumentException("WOW!", ex)
End Try
End Sub
Private Sub b()
Try
c()
Catch ex As Exception
Throw New InvalidCastException("no good", ex)
End Try
End Sub
Private Sub c()
Throw New InvalidOperationException("Bad magic")
End Sub
End Class
I use WPF's awesomeness with DataTemplates. Any exception object it displays will look like an Expander.
|
|
|
|
|
Hi,
I have a problem I can't get solved since days. I'm actually testing nHydrate to generate a DAL to my database.
The case is pretty simple :
I have an object called Maintable
class Maintable {
bool? Booleanfield { get; set; }
DateTime? Datefield { get; set; }
int Idmaintable { get; }
string Stringfield { get; set; }
int? Tostatic { get; set; }
}
In my database I have a static data table ; nHydrate generated for it a collection of objects
class Staticdatatable {
int Idstatic { get; }
string Name { get; }
}
The "Tostatic" field of Maintable object points to Idstatic field in Staticdatatable
So, now I'm trying to perform the following binding :
- Bind combobox list to Staticdatatable collection (this works fine)
- Bind combobox selected item to the Id of the Maintable object (problems start here)
I've bound all my controls in the window correctly to the Maintable object ; but I can't have the combobox displays the name of the corresponding Tostatic value.
The code-behind is :
Maintable CurrentItem = ...
EditionPanel.DataContext = CurrentItem;
cmbStatic.DataContext = StaticdatatableCollection.RunSelect();
The XAML code for combobox is :
<ComboBox x:Name="cmbStatic" ItemsSource="{Binding}" DisplayMemberPath="Name" SelectedValuePath="????" SelectedValue="????"></ComboBox>
My question is : How can I bind the Selected Value to the CurrentItem.Tostatic field defined in code-behind ?
If required I can post the entire code.
Thanks by advance for your help.
|
|
|
|
|
Post here your XAML piece of code would be helpful.
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
OK Sry for late answer
here's the XAML Code (please note I tried to use a textblock to bind the combobox to)
<Window x:Class="WpfnHydrate.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:nhy="clr-namespace:Maxmat.TestnHydrate.Business.Objects;assembly=Maxmat.TestnHydrate"
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="Window1" Height="379" Width="461" Loaded="Window_Loaded">
<Window.Resources>
<Style TargetType="Button">
<Setter Property="Width" Value="50"></Setter>
<Setter Property="Margin" Value="10"></Setter>
</Style>
</Window.Resources>
<StackPanel>
<Border>
<WrapPanel>
<ComboBox Width="50" x:Name="lstMainTable" ItemsSource="{Binding}" DisplayMemberPath="Idmaintable" SelectionChanged="lstMainTable_SelectionChanged"></ComboBox>
</WrapPanel>
</Border>
<StackPanel x:Name="EditionPanel">
<WrapPanel>
<Label>StringField:</Label>
<TextBox Text="{Binding Path=Stringfield, Mode=TwoWay}"></TextBox>
</WrapPanel>
<WrapPanel>
<Label>DateField:</Label>
<my:DatePicker SelectedDate="{Binding Path=Datefield, Mode=TwoWay}" Height="25" Name="datePicker1" Width="115" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" />
</WrapPanel>
<WrapPanel>
<Label>BooleanField:</Label>
<CheckBox IsChecked="{Binding Path=Booleanfield, Mode=TwoWay}"></CheckBox>
<Label>Static Combo</Label>
<ComboBox x:Name="cmbStatic" ItemsSource="{Binding}" DisplayMemberPath="Name" SelectedValuePath="Idstatic" SelectedValue="{Binding Path=Text,ElementName=ToStaticValue,Mode=OneWay, diag:PresentationTraceSources.TraceLevel=High}"></ComboBox>
<TextBlock x:Name="ToStaticValue" Text="{Binding Path=Tostatic}"></TextBlock>
</WrapPanel>
<WrapPanel Margin="10" >
<Button x:Name="cmdNew" Click="cmdNew_Click">New</Button>
<Button x:Name="cmdSave" Click="cmdSave_Click">Save</Button>
</WrapPanel>
</StackPanel>
</StackPanel>
</Window>
|
|
|
|
|
Hi all,
I want to create database populated menu where menu.xaml file should be generated dynamically means my stroed procedure will return result on basis of user Group and that should assign or create xaml file and now dynamically generated file will assign to menu control ..
I have done this in .Net site but dont know its possible with silverlight or not.
I am new to Silverlight , So Please help me...
Reasons are not Important but Results are Important.
Swati Tripathi
|
|
|
|
|
This is possible in Silverlight.
However, you cannot access stored procedures using Ado.Net (as Ado.Net are not available in SL).
You will need to use either a web service or entity framework.
|
|
|
|
|
Thanks for your reply
but i want to know silverlight code sample & yes i am aware of SL will understand xml only.
I hav tried sample which is given in demo for menu but Over there we have static menu.xaml which i dont want to use .
Please help me ....
Reasons are not Important but Results are Important.
Swati Tripathi
|
|
|
|
|
See here for a menu control example.
|
|
|
|
|
Hi..how can I apply textblock properties to Path???
I have convert textblock to path i have applied font , size & color property to it but problem have occured when I am trying to apply textwrapping, alignment, textdecoration & font weight properties but these are not working.
any solution to resolve this problem???
reply fast
thnxxx
|
|
|
|
|
This may give you some ideas
|
|
|
|
|
yes i have already used this but i need to apply all TextBlock properties to Path....any idea??
thnxx
|
|
|
|
|
Properties like textdecoration and fontweight are not valid properties for a Path and so they cannot be applied directly. You will need to create new dependency properties for a path and then implement your own logic to simulate this behaviour.
|
|
|
|
|
any example...?? how can I create these properties on Path???
reply fast??
|
|
|
|
|
To create custom properties, see here.
For an e.g. on a control see here.
Unfortunately I could not find an example where a Path is used.
|
|
|
|
|
any example about Path & textblock??
reply fast
|
|
|
|
|
I've three grids inside a main grid as following:
<Grid Margin="10,10,10,10" Background="#FFE8E8E8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.3*" />
</Grid.ColumnDefinitions>
<Grid x:Name="RedGrid" Margin="0,0,0,0" Grid.Column="0" Background="Red"/>
<GridSplitter Width="4" VerticalAlignment="Stretch" Grid.Column="0"/>
<Grid x:Name="GreenGrid" Margin="0,0,0,0" Grid.Column="1" Background="Green"/>
<GridSplitter Width="4" VerticalAlignment="Stretch" Grid.Column="1"/>
<Grid x:Name="BlueGrid" Margin="0,0,0,0" Grid.Column="2" Background="Blue"/>
</Grid>
I need two behaviors 'CollapseRed' and 'CollapseBlue'. CollapseRed - should collapse RedGrid(left) panel, and then GreenGrid(centre) panel should automatically cover the space on the left side. CollapseBlue - should collapse BlueGrid(right) panel, and then GreenGrid(Centre) panel should automatically cover the space on the right side. Grids are resizable with grid-splitters, and so, we should be able to make it visible again at same place/width by using separate behaviors.
Simple 'Visibility.Collapse' is not working. What change should I make in XAML, and what should be code in C#? Should I use other panels? If yes, please suggest.
So basically, I need functionality somewhat similar to SplitContainer of WinForms, where we can just on/off/change orientation of BlueGrid panel. And, Green panel adjusts accordingly.
modified on Thursday, April 29, 2010 4:20 AM
|
|
|
|
|
Can you try DockPanel instead of outer grid.
|
|
|
|
|
Hmm.. but then, can we use GridSplitters inside a DockPanel? If yes, how?
|
|
|
|
|