|
I rather suspect that you don't need a converter in there mate - both of them should be boolean values.
"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
|
|
|
|
|
I have 4 images of same object.
I want to write small WPF application that show that object in 3D - using the those images.
How can i do it ?
I don't find any example that teach how to do it
Thanks for any help
|
|
|
|
|
See here. Maybe this[^] can help.
|
|
|
|
|
Hi, guys!
I'm having a bit of a trouble with my columns' headers in WPF Datagrid. Some of them are too long, and horizontal stratching is not an option: there are too many of columns, and user will not be able to see full text in headers.
Here is what I'd like to do
I want header "Word1 word2 word3 word4 word5 word6"
to look like
"Word1 word2 word3
word4 word5 word6" - so it srteches vertically.
Thanks in advance
|
|
|
|
|
I haven't tried it, but I should imagine that all you need to do is set a style with a TargetType of tk:DataGridColumnHeader , and set the TextWrapping in there.
"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
|
|
|
|
|
Hi ,
In WPF, am trying to create ListView, Which binds with list of class KPI objects. Where the KPI class contains Name(string), StackPanel(which contains TextBlock + Image).
I want to show only the StackPanel into the list , not the Name property. How do we bind the stack panel object alone .
<listview name="lvKPI" grid.row="1" margin="5,5,5,78"
="" selectionmode="Single" itemssource="{Binding KPICollection}" itemcontainerstyle="{StaticResource alternatingListViewItemStyle}" alternationcount="2">
<listview.view>
<gridview.columns>
|
|
|
|
|
you need to define the stackpanel in a column template.
|
|
|
|
|
Hi,
thanks. Can u pl help me here giving me example for this ?
thanks
|
|
|
|
|
|
I figured out how to see if an object within a container is a specific object, but how to translate it to another container? The following doesn' t work.
foreach (UIElement el in LayoutRoot.Children)
{
if (el is Button)
{
LayoutRoot.Children.Remove(el);
StackPanel1.Children.Add(el);
}
}
|
|
|
|
|
As per my understadning, it is containing reference of button so it may be the cause.
Try with following DeepCopy approach:
foreach (UIElement el in LayoutRoot.Children)
{
if (el is Button)
{
string shapestring = XamlWriter.Save(el);
StringReader stringReader = new StringReader(shapestring);
XmlTextReader xmlTextReader = new XmlTextReader(stringReader);
UIElement DeepCopyobject = (UIElement)XamlReader.Load(xmlTextReader);
StackPanel1.Children.Add(DeepCopyobject);
LayoutRoot.Children.Remove(el);
}
}
If it is not working or if you have any other approach then please let me know.
Thanks,
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
If you run that code in debug mode you WILL experience an exception.
You cannot remove an item from a collection that is being enumerated. So what I do in that case is this:
List<int> itemsToRemove = new List<int>();
for ( int index = 0; index<LayoutRood.Children.Count; index++ )
{
if ( LayoutRoot.Children[index] is Button )
itemsToRemove.Add(index);
}
foreach ( int element in itemsToRemove )
{
Button oldElement = LayoutRoot.Children[element] as Button;
LayoutRood.Children.RemoveAt(element);
StackPanel1.Children.Add(oldElement);
}
Take this one warning into account: you MIGHT get an exception that the element is already a member of another collection. The exception will point at your StackPanel1 add to the elements. If that happens then do the following:
Button newElement = new Button;
newElement.Name = oldElement.Name;
.
.
.
|
|
|
|
|
Hi,
I'm following a Data Binding example from: microsoft[^] which displays the expected result in the VS2008 design window on XP but not when I run it. The XML looks OK to me with the XMLDataProver in a Resource :
<XmlDataProvider x:Key="MoreColors" XPath="/colors">
and the ListBox attribute :
ItemsSource="{Binding Source={StaticResource MoreColors}, XPath=color/@name}">
, any ideas why it displays data in the ListBox in design mode in VS2008 but doesn't display any data in the ListBox when its run?
<Window x:Class="WpfText2LableBinding.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">
<StackPanel>
<StackPanel.Resources>
<XmlDataProvider x:Key="MoreColors" XPath="/colors">
<x:XData>
<colors >
<color name="pink"/>
<color name="white"/>
<color name="black"/>
<color name="cyan"/>
<color name="gray"/>
<color name="magenta"/>
</colors>
</x:XData>
</XmlDataProvider>
</StackPanel.Resources>
<TextBlock Width="248" Height="24" Text="Colors:" TextWrapping="Wrap"/>
<ListBox x:Name="lbColor" Width="248" Height="56" IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Source={StaticResource MoreColors}, XPath=color/@name}">
</ListBox>
</StackPanel>
</Window>
|
|
|
|
|
I answered this here[^]. Add the namespace I mention in the answer and you are good to go.
"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, you identified the cause though I think your linked solution is wrong (in this case anyway). It's now working but I had to use:
<br />
<x:XData><br />
<colors xmlns=""><br />
rather then the
<br />
<x:XData xmlns=""><br />
<colors ><br />
in your link. I found another MS example which uses xmlns in this manner:
<StackPanel.Resources>
<XmlDataProvider x:Key="InventoryData" XPath="Inventory/Books">
<x:XData>
<Inventory xmlns="">
<Books>
<Book ISBN="0-7356-0562-9" Stock="in" Number="9">
<Title>XML in Action</Title>
<Summary>XML Web Technology</Summary>
</Book>
|
|
|
|
|
Hey Guys,
I am drawing custom user controls onto a Canvas using a placement algorithm, the problem is that when the placement algorithm runs the controls Height has not yet been calculated and is 0 causing other object around it to be placed invalidly, how can I get it so that the height is set before I run my placement algorithm?
Cheers,
Ian
|
|
|
|
|
Hi Ian,
You can set a fixed height and width to your UserControl and then you will have the ActualHeight property set to it before drawing it to the screen.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
Do you mean that I set the User Controls .Width and .Height properties?
|
|
|
|
|
Yes, you have to set the height & width of the UserControl in the XAML itself, else it will set after rendering.
Have a look into the following code snippet for setting the dimension of the control:
<UserControl ...
...
Height="200" Width="400">
</UserControl>
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
But the control is created programmatically in code.
|
|
|
|
|
If you created it programmatically, then use the following way to set the height & width of the usercontrol:
MyUserControl uc = new MyUserControl();
uc.Height = 200.0;
uc.Width = 400.0;
...
...
...
LayoutRoot.Children.Add(uc);
Let me know, if you have any queries.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
I've developed several WPF controls and themes, and would like to showcase them. I've created another WPF application which contains them all, which works fine. Now, I want to put those controls onto web. Is it possible without re-writing the whole code for Silverlight? I've few problems due to Silverlight restrictions. I am using 3.5 framework.
Also, can we edit/create a Silverlight project in Visual C# 2008 express edition?
modified on Friday, July 23, 2010 5:13 AM
|
|
|
|
|
WPF != Silverlight ... ish!
You need Web Developer Express to do Silverlight ...
|
|
|
|
|
You can create a WPF Bowser application an XBAP
http://www.xbap.org/tutorial.html
Every one among us was a beginner once
|
|
|
|
|
That's not, actually, a good suggestion - while you can create a WPF browser app, it's not going to run on certain browsers, and not on a Mac or Linux box. This limits the target audience who can view what he's done.
"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
|
|
|
|