« first day (4491 days earlier)      last day (440 days later) » 

mr5
1:19 AM
SAML sucks
 
 
7 hours later…
8:01 AM
 
8:20 AM
Good moaning
 
good moaning
 
Good morning
Can anyone take a look at this question please?
0
Q: Providing empty data from a model to a component

vaeonI have two components like this: <div class="col"> <p>To Do</p> <Dropzone Items="MyFirstList" Class="h-100"> <ChildContent> <div class="card" style="border-left: 3px solid black"> <div class="card-body"> <h6>@context.Title</h6> ...

I am a beginner at C#/Blazor and I am a bit stuck
 
admin
 
 
2 hours later…
10:23 AM
'sup
 
10:35 AM
Hello Huys good morning
Guys*
 
10:50 AM
Hello Juys
 
Hello Kuys
 
Hope you Juys/Kuys are doing well :)
 
11:16 AM
case "ReadPricing": //to read local pricing file
			ProductPriceList = GetProductsPriceList();
			View = CollectionViewSource.GetDefaultView(ProductPriceList);
			View.Filter = Filter;
			View.Refresh();
			return;

case "cm2inches": // convert from cm to incehs vice versa
	if (ProductPriceList != null)
	{
		foreach (Products pp in ProductPriceList)
		{
			var cm2inches = RenameToInches(pp.Name);
			Console.WriteLine("RenameToInches Products: {0}", RenameToInches(pp.Name));


			//View = CollectionViewSource.GetDefaultView(cm2inches);
I read a file and load to the datagrid using view
then i wan tto update a particular property how cna i update it to the view?
 
I have a deja vu
 
@Squirrelkiller lol :)
 
Call the PropertyChanged event with the name of the property you want to update
 
@Squirrelkiller pp.name is the property, i'm able to update the property pp.Name then i dont know how to update it to the View
may be im missing something
  public void OnPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
 
Easy version: update the whole View property
 
11:26 AM
@Squirrelkiller Yes thats correct, how?
 
OnPropertyChanged(nameof(View));
 
:55916562 if (ProductPriceList != null)
{

foreach (Products pp in ProductPriceList)
{
	var cm2inches = RenameToInches(pp.Name);
	Console.WriteLine("RenameToInches Products: {0}", RenameToInches(pp.Name));
	OnPropertyChanged(nameof(View));
}
}
Nothing changed
 
What should have changed?
 
Name property in the datagrid is not updated
 
Are you sure the Name property in the model is updated?
 
11:32 AM
private ObservableCollection<Products> productpricelist;

        public ObservableCollection<Products> ProductPriceList
        {
            get { return productpricelist; }
            set
            {
                productpricelist = value;
                OnPropertyChanged("ProductPriceList");
            }
        }
 
Console.WriteLine("Actual property the view will read: {0}", pp.Name);
 
@Squirrelkiller Yes
 
@user838691 In this case, you'd have to call OnPropertyChanged(nameof(ProductPriceList)) instead of with View
(After updating the Name)
 
 foreach (Products pp in ProductPriceList)
                        {
                            RenameToInches(pp.Name);
                            Console.WriteLine("RenameToInches Products: {0}", RenameToInches(pp.Name));
                            OnPropertyChanged(nameof(ProductPriceList)); }
Is it ocrrect?
Is it correct?
 
Maybe
Add Console.WriteLine("Actual property the view will read: {0}", pp.Name); at the end just in case
 
11:39 AM
@Squirrelkiller this return the old value that means OnPropertyChanged(nameof(ProductPriceList)) doesnt work
 RenameToInches(pp.Name);
RenameToInches(pp.Name));
 OnPropertyChanged(nameof(ProductPriceList));
 Console.WriteLine("Actual property the view will read: {0}", pp.Name);
 
Hence my question about if you update of the model actually works
What does RenameToInches do?
 
 public static string RenameToInches(string cm)
        {
            var dic = GetCentimetersToInchesPairs();
            foreach (var pair in dic.OrderByDescending(x => x.Key.Length))
            {
                cm = cm.Replace(pair.Key, pair.Value);
            }
            return cm;
        }
@Squirrelkiller Its a method returns string which i'm using to update a property Name in the class Products
 
You aren't updating the property Name though?
pp.Name = RenameToInches(pp.Name);
That would do it
 
@Squirrelkiller Yes it works, great thanks a lot man.
 foreach (Products pp in ProductPriceList)
                        {

                            pp.Name = RenameToInches(pp.Name);
                            //Console.WriteLine("RenameToInches Products: {0}", RenameToInches(pp.Name));
                            OnPropertyChanged(nameof(ProductPriceList));
                            Console.WriteLine("Actual property the view will read: {0}", pp.Name);
                            View = CollectionViewSource.GetDefaultView(ProductPriceList);
i dont know to keep the View part in this code becasue it works even without view as the property updated by OnPropertyChanged(nameof(ProductPriceList));
 
 
3 hours later…
2:47 PM
 
3:46 PM
@user838691 View.Refresh();?
Feel like something is wrong
 
@juanvan thanks let me check it out.
 
What are you trying to do, and is it MAUI related or vanilla WPF/XAML?
 
@juanvan WPF/XAML
 
You're trying to update the ProductPriceList multiple times for the product to inches
Why not update the list, then represent it once
If you're trying to do a screen update of some kind, you're better basing it off the Progress class, it will update the UI from a background thread
 
 pp.Name = RenameToInches(pp.Name);
 OnPropertyChanged(nameof(ProductPriceList));
 
3:53 PM
ya, you're trying to update the UI as each is changed?
 
then i must refresh the view to make it work else i dont see the updated data
@juanvan yes thats correct
 
Must look kind of funny on the screen all the redraws ?
 
@juanvan its a datagrid col property
 
Ya, refreshing the view on simple changes is a hard at first but you get there, if ya need to.

I guess if it's working as is then, run with it
 
@juanvan ok thanks...
 
4:40 PM
Might be better to update the view after the loop
Just gotta learn to work with the official unit system of the United States now: Metric
 
5:07 PM
posted on February 01, 2023 by ericlippert

In the autumn of last year my friend Joan and I went on a little trip up to the Skagit valley north of Seattle to photograph birds of prey; I managed to get a blurry but recognizable shot of this … Continue reading →

 
 
1 hour later…
6:11 PM
@Squirrelkiller ISO 8601
 
6:24 PM
 

« first day (4491 days earlier)      last day (440 days later) »