|
You could try binding the background brush to the textbox and use a custom converter that receives as a parameter the string from the cell.
Mihai,
|
|
|
|
|
|
Good afternoon colleagues:
I have a tricky question, on which even Microsoft's evangelist could not provide a clear solution.
I want to compare performance of WinForms and WPF rendering models.
For that purpose I measure time span between content update event and rendered event.
In WinfForms the operation is very straight forward, cause there is an OnPaint event. But in WPF I cannot find an analog of this event.
Certainly, the rendering model in WPF is totally different, thus refresh of the data is performed somehow in another way.
So, to be more precise, I want to know when actually the content appears on the screen.
I have conducted some research and there is seems to be a Load event, which serves for this purpose, but this event is fired only once on application start up.
Perforator somehow measures rendering time. But it doesn't use WPF for that purpose, but WinAPI.
Thanks!
/LOOM
|
|
|
|
|
|
Hi Mark!
I have already seen this document. Probably, need to address it again.
BTW, on the Microsoft's forum I was recommended to use RenderSizeChanged event. Will try it an get back later.
Thanks!
/LOOM
|
|
|
|
|
Hi again!
I created an UserControl which is a singleton.
public partial class DeepDisplay : UserControl
{
private static DeepDisplay instance;
private static object lockObject = new object();
private DeepDisplay()
{
InitializeComponent();
}
public static DeepDisplay GetInstance()
{
lock (lockObject)
{
if (instance == null)
instance = new DeepDisplay();
}
return instance;
}
}
What I want to do is to add this UserControl in the XAML Part of the code.
<local:DeepDisplay x:Name="deepDisplay" Width="Auto"></local:DeepDisplay>
Due to the fact that the Constructor is private, I need to call the GetInstance Method instead.
Can this be done easily and if so, can someone be so kind a show me how?
As always thank you in advance,
eza
|
|
|
|
|
I'm quite sure that is impossible.
Anyway, a singleton control sounds like a very bad idea. First of all why would you need such a thing? Seccondly, how would you expect it to work when you add a seccond "instance" of the control? I'm asking this because a control can only have one parent, so it can't be in to places at once.
On the other side, if you want to make sure that the control is only used once, you could keep track of the number of instances created in a static variable, and throw an error when another instance has already been created.
Mihai,
|
|
|
|
|
hi,
I have a result set form the database stored in the ILIST. I want to bind this to a listview[in which i use grid view]. Does any one have a solution for this ..if, plz help me
|
|
|
|
|
|
Hi All,
I feel like I should know the answer to this by now but I'm stuck.
I have a number of combo boxes in the UI, the contents of one is dynamic based on the selected item of another. All the comboboxes are bound to OberservableCollections created in a static ComboBoxManager class.
Whats the best way of handling the selection changing in the first combobox in order to populate the second combobox with the correct contents?
How do I get this selection changed event into this other class? Do I have to register a custom event in the ComboBoxManager class? Or can I create a 'Selection' property on the ComboBoxManager class and bind the first comboboxes selected item to it in a two way binding to this property and add a handler to this property to kick off some code when it changes?
Or is this all a bit overkill and I just need to use a RoutedEvent listener in the ComboBoxManager class??
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
I've just created a small expample solution showing what I'm trying to do. I want to keep all the code out of the Window1 class basically whilst pointing the comboboxes to the event hander in the ComboBoxManager class. You can get the solution here:
EventRouting.zip[^]
Any input on this would be really appricated.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer mate. The answer to your problems is here[^].
|
|
|
|
|
Hey Fella,
Ahhh! Josh Smith ... you know what's crazy thing ...
The application I'm working on for my employer uses Dan Crevier's DM-V-VM models extensively. We've also wrapped up the access to each data model (one per screen in the app) in a plug-in architecture where everything communicates through interfaces making it all really modular. Two developers can work on the contents of two screens without ever going near each others code/implementation. Its a really neat solution.
For my app (of which you are very aware! I started out thinking that this was a tad overkill. How wrong was I? I've only scanned this Josh Smith article so far ... methinks I need to down tools and have a rethink ...
Thanks chap.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
If I can give any advice, it's read Josh's article on MVC and his Podder series. When you get your head round those, you finally say - "Damn it. I get it now. Now I know why I should be doing things this way in WPF." The MVC article, for me in particular, was the missing piece - the bit I needed to get it all working in my head (well, that and thinking about WPF from an ASP.NET point of view - take a look at my article on WPF if you want to see what I mean).
|
|
|
|
|
Josh rocks ... will do fella!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer wrote: Josh rocks
That's why he's the RockStar.
|
|
|
|
|
Indeed!! Now get back to your beta testing!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Yes boss - although I might just wait for the new loose coupled, MVC SampleSort.
|
|
|
|
|
Oooh ... imagine ... a slide out search criteria panel ...
I feel all slinky just thinking about it! It makes so much sense when I think about it ...
You know, I think what put me off it all for SS was that I started reading Dan's DM-V-VM blog when a new contractor started at work, at that time I had been looking at/using C# for all of two weeks and WPF for about 3 days (this was back in Feb) and it so confused me at the time. To be completely honest I wasn't even aware of the issues/limitations/obstacles that it was addressing let alone be in a position to really appreciate why such a pattern was at all beneficial.
After working with FoxPro for so long prior to that I was still getting my head around where my data was!!!! But, but ... where are the tables goddammnit!!!!
Oh ... fond memories ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hey - I've been coding for nigh on 30 years. Don't worry about it, there's still shedloads for me to learn in WPF. That's the beauty of it.
|
|
|
|
|
Indeed, I do find myself getting annoyed that I should *really* get some things by now, I need to remember that I'm a real newbie to all this, I'm still encountering more new topics every day than ones I feel comfortable with ...
I spent most of today battling with dynamically generated SSIS packages ... hairy business I can tell you!
Anyway, this is really drifting OT now!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
i have a small rec in which i have to bind the listview with the Ilist which is a generic collection.
cheers
chandu
|
|
|
|
|
|
create on class like product
and do the following things
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class Product
{
private string _productName;
public string ProductName
{
get { return this._productName; }
set { this._productName = value; }
}
public Product()
{
}
}
--------------------
then create other calls
public class ProductRepository
{
public static IList<product> GetProducts(string criteria)
{
string key = "Products_" + criteria[0];
IList<product> list = CacheRepository.GetObjects<product>(key);
if (list == null || list.Count == 0)
{
list = DataAccess.GetProducts(criteria);
CacheRepository.SaveObject(key, list);
}
// return the list based on the criteria
List<product> productList = list as List<product>;
list = productList.FindAll(delegate(Product product)
{
return product.ProductName.ToLower().StartsWith(criteria.ToLower());
});
return list;
}
}
-------------------------------
public class DataAccess
{
public static IList<product> GetProducts(string criteria)
{
List<product> list = new List<product>();
// Fill the list with any data source
while (reader.Read())
{
Product product = new Product();
product.ProductName = reader["name1"] as String;
list.Add(product); //which fill the list
}
}
return list;
}
}
------------------------------
Then
in the Page_Load or any method
you can bind this way
IList<product> list = null;
Listview listview = new Listview();
listview.DataSource = list;
listview.DataBind();
|
|
|
|
|
I am using Nhibernate.
how to get data from database , assign the result set to the Ilist and bind that Ilist to the ListView in wpf.
thanks for your reply...
its helpful
cheers
chandu
|
|
|
|