|
hi.
thanks for the tip.
As soon i get results i'll tell you.
Regards.
|
|
|
|
|
Say, if the TreeView control is 200px width and the TreeViewItem's width is more than 200px, I need to show the tooltip. Is there a way to show tooltip on that scenario in WPF?
|
|
|
|
|
Hello
I have created a class inherits frameworkelement which i am using to graphically represent an object in my WPF project. My first attempt overrides the onRender method and draws a rectangle, using property's length and width.
I am doing this to reduce the overhead required for each object as i will have a number of these on the page at one time.
This works fine, now i want to do the same thing but draw a more complicated shape the path. I do not know where to start with this, has anyone attempted this before if so how did you do this??
Here is my working code for simple rectangle.
Protected Overrides Sub OnRender(ByVal drawingContext As System.Windows.Media.DrawingContext)
drawingContext.DrawRectangle(Status, New Pen, New Rect(0, 0, conveyorLength, conveyorWidth))
MyBase.OnRender(drawingContext)
End Sub
Thanks
|
|
|
|
|
You can do something along those line:
protected override void OnRender(DrawingContext dc)
{
dc.PushClip(new RectangleGeometry(new Rect(RenderSize)));
dc.DrawGeometry(Background, new Pen(BorderBrush, BorderWidth), GetHandleGeometry());
dc.Pop();
}
public StreamGeometry GetHandleGeometry()
var result = new StreamGeometry();
result.FillRule = FillRule.EvenOdd;
using (StreamGeometryContext ctx = result.Open())
{
ctx.BeginFigure(new Point(s.Width, 0), true, false);
ctx.ArcTo(new Point(s.Width - r, r), CS, 90, false, SweepDirection.Clockwise, true, true);
ctx.LineTo(new Point(r + w, r), true, true);
ctx.ArcTo(new Point(w, 2 * r), CS, 90, false, SweepDirection.Counterclockwise, true, true);
.............
}
return result;
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi,
I wanna show an image in WPF that is created by a process,
e.g : we have a method that is named createWPFImage()
Image createWPFImage() { ... }
So, the output of createWPFImage() is an Image.
In the XAML code we have a something like below :
<StackPanel.ToolTip>
<StackPanel Orientation="Horizontal">
<Image Width="64" Height="64" Margin="0 2 4 0" />
<TextBlock Text="{Binding Path=Description}" VerticalAlignment="Center" />
</StackPanel>
</StackPanel.ToolTip>
Now, How can I bind the output of createWPFImage() to the Image in XAML code ?
I would be appreciate if you guide me.
|
|
|
|
|
There are many different ways of accomplishing this. You could give your Image a name, and bind to it directly in code, or you could use a ViewModel, and bind to the image via the VM, or you could use an ObjectDataSource which allows you to call this method, and bind to it from your image.
"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 Pete, I'm gonna use VM.
Do you know any samples ?
|
|
|
|
|
_Mohammad_ wrote: I'm gonna use VM.
Good man. You can find code in my Songbird[^] article that shows how to bind an image from the VM.
"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 want to develop WPF application for Window on Mac. is It ok? or i should buy any other Desktop system for Development on Expression Blend. Right now i have Hp(TouchSmart Pc) but it performance is not good.
Right now i want to purchase any other for High performance can any body recommend any PC.
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
Hi,
so your question is the recommended hardware requirement for designing WPF with Expression Blend?
The official site says something about the minimum requirements:
http://www.microsoft.com/expression/products/Blend_SysRequirements.aspx[^]
So I guess a fast processor (with two or more cores), 4GB RAM or more and a good graphic card will do the job. I would say that you don't have to buy a MAC, just upgrade your machine or buy a new one.
Regards
Sebastian
|
|
|
|
|
Hello,
For my scientific application, I need a WPF control to display matrices of floating-point numbers. The sizes of matrices differ from 1*1 to approx. 100k*64. Rows may differ by foreground color (2 types), and columns may differ by background color (also 2 types).
An example is here: http://bartoszbien.com/public/MatrixCtrl.png.
Using a ListView , I've been able to display values in cells, and to color the text as needed. However, I'm not able to set background color for the columns, because setting a CellTemplate for a column does not work (by design) when the DisplayMemberBinding is set.
Do I need to write my own control from scratch, or is it possible to reach my goal using the ListView ?
My style for the rows:
<Style x:Key="MatrixRowStyle" TargetType="{x:Type ListViewItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="Type1">
<Setter Property="Foreground" Value="Lime" />
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="Type2">
<Setter Property="Foreground" Value="RoyalBlue" />
</DataTrigger>
</Style.Triggers>
</Style>
My DisplayMemberBinding for the columns:
column.DisplayMemberBinding = new Binding(string.Format("Values[{0}]", count));
The Values member comes from:
public class MatrixRow
{
public EType Type { get; set; }
public double[] Values { get; set; }
}
The ListView 's ItemsSource is assigned with an IEnumerator of MatrixRow objects.
|
|
|
|
|
How about writing a custom
GridViewColumn.CellTemplate ?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Issue: How to expose A/D attributes to/with Silverlight
Environment: VS.NET 2008 Pro w/Silverlight 3
What I have done so far:
I currently am able to get the currently logged in user by doing this in my
.aspx file:
<param name="initParams" value="FullName=<%= GetObject("WinNT://" & request.servervariables("AUTH_USER").replace("\", "/")).FullName %>"/>
But this will only allow me to access server variables, not AD attributes as needed.
Anyone know the best path for me to go down?
I'm thinking generally I need to perhaps utilize: ADSI (GetObject), or LDAP/Directory Services
Cheers,
Rich
|
|
|
|
|
Something similar was asked earlier here[^].
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
man, I look forward to when it's more straightforward.
Thanks for the pointer.
|
|
|
|
|
Hi,
I have produced a small drawing package which lets a user draw lines and shapes on a canvas. At the moment a popup on each shame allows the user to select line colour and thickness, which at the moment are just text boxes, but I would now like to provide a combobox containing a few different line StrokeDashArray styles but am unsure how to do this.
My initial thinking is that I should create a StaticResource collection to set as the ComboBox's ItemsSource, but I am unsure what to create a collection of?
Does anyone have any ideas on how I can achieve this?
Richard
modified on Thursday, February 4, 2010 6:06 AM
|
|
|
|
|
Suppose you allocate a list of Line objects,
public ObservableCollection<Line> Lines = new ObservableCollection<Line>();Populate them with the values that you want. Here, I allocate a set of stroke styles:
public Window1()
{
InitializeComponent();
Lines.Add(AddLineStyle(1, 2, 4));
Lines.Add(AddLineStyle(3, 3, 4));
Lines.Add(AddLineStyle(3, 2, 4));
Lines.Add(AddLineStyle(1, 2, 4));
Lines.Add(AddLineStyle(3, 3, 4));
Lines.Add(AddLineStyle(3, 2, 4));
DataContext = Lines;
}
private Line AddLineStyle(int thickness, int array0, int array1)
{
Line line = new Line();
line.StrokeThickness = thickness;
double[] dashArray = new double[2];
dashArray[0] = array0;
dashArray[1] = array1;
line.StrokeDashArray = new DoubleCollection(dashArray);
return line;
} Now, in my XAML, I just bind to it and set up a simple template:
<Window x:Class="LineDashStyleSample.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">
<Window.Resources>
<DataTemplate x:Key="LineCombo">
<StackPanel Height="20">
<Line
X1="5"
Y1="5"
X2="190"
Y2="5"
Stroke="Blue"
StrokeThickness="{Binding StrokeThickness}"
StrokeDashArray="{Binding StrokeDashArray}" />
</StackPanel>
</DataTemplate>
</Window.Resources>
<StackPanel>
<ComboBox
Width="200"
Height="30"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource LineCombo}" />
</StackPanel>
</Window> This is just a sample - as you're effectively hooking an entire object for just two objects, you could create a lighter weight object and use that instead:
public class DashedLineStyle
{
public int Thickness { get; set; }
public DoubleCollection StrokeDashArray { get; set; }
} Then, you replace the Line type in your ObservableCollection, and the AddLineStyle method to instantiate and return an instance of DashedLineStyle instead. I hope that this helps.
"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
|
|
|
|
|
Many thanks, this is exactly what I was after! =)
Rich
|
|
|
|
|
Cool. Good job.
"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
I want to deploy a WPF application using ClickOnce on tablet PC with winXP. Application run fine on Dev. machine and other user's dev. machines also.
But on tablet PC , it crashes with the message:
EventType clr20r3.
P1: ApplicationName.exe
P21.0.0.0
P3 4b68898e
p4: mscorlib
P5: 2.0.0.0
P6 4a7cd8f7 p7: 261 p8:1a
p9: System.argumentnullException
p10 : Nil
On target pc is installed with .NET 1.1, 2.0 sp2, 3.0 sp2 and 3.5 sp1 .
I tried some other sample small and simple wpf applications on same tablet PC, they run properly with same clickOnce deployment
I don't know what's the problem is, need help.
Thanks,
vsaratkar
|
|
|
|
|
try something along the lines:
AppDomain.CurrentDomain.UnhandledException += UnhandledException;
or
Application.Current.DispatcherUnhandledException += UnhandledException;
....
void UnhandledException(.....)
{
Exception ex = .....
MessageBox.Show(ex.StackTrace)
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Thanks Super Lloyd
This is the stack Trace
at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.ThrowExceptionWithLine(String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
I am using threading in my application. I can't figure out what's wrong.
Please help.
Vsaratkar
|
|
|
|
|
I said something along the lines but it's clearly not enough!
You better show all inner exception (ex, ex.InnerException, ex.InnerException.InnerException, etc..)
and their error messages!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
For the record here is the method I use to retrieve log information from an Exception:
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Diagnostics;
namespace Agtrix.Utility
{
public static class ExceptionUtils
{
public static IEnumerable<Exception> GetAllExceptions(this Exception ex)
{
if (ex == null)
yield break;
yield return ex;
if (ex is ReflectionTypeLoadException)
foreach (Exception ex2 in ((ReflectionTypeLoadException)ex).LoaderExceptions)
foreach (Exception ex3 in GetAllExceptions(ex2))
yield return ex3;
if (ex.InnerException != null)
foreach (Exception ex2 in GetAllExceptions(ex.InnerException))
yield return ex2;
}
public static string ToDetailString(this Exception exception)
{
StringBuilder builder = new StringBuilder();
bool first = true;
foreach (Exception ex in GetAllExceptions(exception))
{
if (!first)
builder.Append("\r\n-------- Caused by Exception --------\r\n");
builder.AppendFormat("Exception : {0}\r\n", ex.GetType());
if (!string.IsNullOrEmpty(ex.Message))
builder.AppendFormat("Message : {0}\r\n", ex.Message);
if (!string.IsNullOrEmpty(ex.Source))
builder.AppendFormat("Source : {0}\r\n", ex.Source);
if (!string.IsNullOrEmpty(ex.HelpLink))
builder.AppendFormat("Help : {0}\r\n", ex.HelpLink);
if (ex.Data.Count > 0)
{
builder.Append("Data\r\n");
foreach (var item in ex.Data.Keys)
{
string key = item.ToString();
string val = string.Format("{0}", ex.Data[item]);
if (val.IndexOfAny(new char[] { '\r', '\n' }) > -1)
builder.AppendFormat("\t{0}:\r\n{1}\r\n", key, val);
else
builder.AppendFormat("\t{0}: {1}\r\n", key, val);
}
}
builder.AppendFormat("Stack :\r\n{0}\r\n", ex.StackTrace);
first = false;
}
return builder.ToString();
}
}
}
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|