|
|
And which format will be used - degrees, minutes, seconds, ...?
|
|
|
|
|
|
|
psst - Yogi say thank you properly and give him an up vote (little arrows beside the title)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
We can expose a button as ActiveX contol method. Also we can expose a button as MEF plug-in. My question is can use MEF logic for exposing the button instead of exposing the button using ActiveX control. Please let me know the effectiveness of using the button in both ways. The usabilty of that button is for testing purpose.
|
|
|
|
|
I have a Radgridview contains some rows i need to preview the telerik radgridview items first then i need to print the specified document (if i have 5 radgridview items i need to display each row in each page with radgridview header.
|
|
|
|
|
Try this[^] - it may provide some insight.
Posting this on the Telerik forum might give you some solution.
|
|
|
|
|
My previous post about detecting property changes in the VM wasn't in depth enough, so I'm posting this
I have a grid of Jobs. Each job can have one or more employees.
The DataGrid's RowDetailsTemplate contains another grid to show the employees. So to parent grid is bound to a list of Jobs. The inner grid is bound to a list of Employees that is on the Job model.
The Job Model:
public class Job : _Base
{
private string _JobName = string.Empty;
public string JobName
{
get { return _JobName; }
set
{
if (_JobName != value)
{
_JobName = value;
RaisePropertyChanged("JobName");
}
}
}
private string _JobNumber = string.Empty;
public string JobNumber
{
get { return _JobNumber; }
set
{
if (_JobNumber != value)
{
_JobNumber = value;
RaisePropertyChanged("JobNumber");
}
}
}
private ObservableCollection<Employee> _Employees;
public ObservableCollection<Employee> Employees
{
get { return _Employees; }
set
{
if (_Employees != value)
{
if (_Employees != value)
{
_Employees = value;
RaisePropertyChanged("Employees");
}
}
}
}
private Employee _SelectedEmployee;
public Employee SelectedEmployee
{
get { return _SelectedEmployee; }
set
{
if (_SelectedEmployee != value)
{
if (_SelectedEmployee != value)
{
_SelectedEmployee = value;
RaisePropertyChanged("SelectedEmployee");
}
}
}
}
public Job()
{
Employees = new ObservableCollection<Employee>();
}
}
The Employee model
public class Employee : _Base
{
private string _EmployeeName = string.Empty;
public string EmployeeName
{
get { return _EmployeeName; }
set
{
if (_EmployeeName != value)
{
_EmployeeName = value;
RaisePropertyChanged("EmployeeName");
}
}
}
private bool _IsChecked = false;
public bool IsChecked
{
get { return _IsChecked; }
set
{
if (_IsChecked != value)
{
_IsChecked = value;
RaisePropertyChanged("IsChecked");
}
}
}
}
The XAML
<DataGrid ItemsSource="{Binding Jobs}"
SelectedItem="{Binding SelectedJob}"
AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Job Name" Binding="{Binding JobName}" />
<DataGridTextColumn Header="Job Number" Binding="{Binding JobNumber}" />
</DataGrid.Columns>
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<DataGrid ItemsSource="{Binding Employees}"
SelectedItem="{Binding SelectedEmployee}"
AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{Binding IsChecked}"/>
<DataGridTextColumn Binding="{Binding EmployeeName}"/>
</DataGrid.Columns>
</DataGrid>
<Button Margin="5"
Height="23"
Width="75"
HorizontalAlignment="Left"
Content="Remove"/>
</StackPanel>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
The MainWindowViewModel
public class MainWindowViewModel : _Base
{
private ObservableCollection<Job> _Jobs;
public ObservableCollection<Job> Jobs
{
get { return _Jobs; }
set
{
if (_Jobs != value)
{
if (_Jobs != value)
{
_Jobs = value;
RaisePropertyChanged("Jobs");
}
}
}
}
private Job _SelectedJob;
public Job SelectedJob
{
get { return _SelectedJob; }
set
{
if (_SelectedJob != value)
{
if (_SelectedJob != value)
{
_SelectedJob = value;
RaisePropertyChanged("SelectedJob");
}
}
}
}
public MainWindowViewModel()
{
this.PropertyChanged += new PropertyChangedEventHandler(MainWindowViewModel_PropertyChanged);
}
void MainWindowViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName.Trim().ToLower() == "ischecked")
{
int x = 1;
}
}
}
I have a couple of questions:
1) The SelectedEmployee property on the Job model does not fire when I click an employee in the inner grid.
2) The MainWindowViewModel_PropertyChanged does not fire when an employee is selected.
3) Notice the button below the inner grid. How do I bind its command to MainWindowVM?
If it's not broken, fix it until it is
|
|
|
|
|
I have a data grid bound to a list of Job Models. The Job Model has a Job Name property.
I can tell when a row is selected because the grid's SelectedItem is set. But when the user changes some data in the grid, I'd like to do some things in the view mdoel.
When the user changes the Job Name on the active row in the grid, how can the View Model know about it?
Thanks!
If it's not broken, fix it until it is
|
|
|
|
|
Make sure that you have two-way databinding set in the textbox, and editing name in the active row will update the name property (I'm also assuming that you are updating the name field via the standard PropertyChanged event here; hence 2-way binding).
|
|
|
|
|
I think I wasn't clear.
What I want it to detect in the VM that a property on a model has changed. How do I set this up in the VM?
My models implement INotifyPropertyChanged. But I want to take action in the VM when a property on the model changes
[UPDATE]
I think what I want it to handle a Job_PropertyChanged event in the VM. But the Jobs are coming back from the DAL, so where/how do I wire up the event handler in the VM??
If it's not broken, fix it until it is
|
|
|
|
|
This is one of those cases where it make more sense to "break" the fall through to the model so that you handle the change in the VM, and then forward the result onto the model. It's a simple solution and doesn't require you to add any other events.
|
|
|
|
|
Ok, what I'm asking is HOW? What's the syntax? What does the code in the VM look like?
If it's not broken, fix it until it is
|
|
|
|
|
Let's assume you have a Model that looks like this:
public class MyModel : PropertyChangeBase
{
private string _name;
public string Name
{
get { return _name; }
set
{
if (_name == value) return;
_name = value;
RaisePropertyChanged("Name");
}
}
} Then, there's this VM:
public class MyViewModel : PropertyChanged
{
private MyModel _model;
public string Name
{
get { return _model.Name; }
set
{
if (_model.Name == value) return;
_model.Name = value;
RaisePropertyChanged("Name");
}
}
} Then, your view simply binds to the Name property on your model. It's nothing complicated.
|
|
|
|
|
Ugh, I hate when people do this .
Just subscribe to _model.OnPropertyChanged += ...; and check for the properties you are interested in.
Only time you want to write a new getter / setter IMO is when the original property doesn't support INPC or you need INPC to behave in a different way for said property.
|
|
|
|
|
SledgeHammer01 wrote: Only time you want to write a new getter / setter IMO is when the original property doesn't support INPC or you need INPC to behave in a different way for said property.
Indeed, and as he wants to do something a different way for said property, this is the simplest solution, especially as it doesn't involve managing the lifetime of a none weak event subscription just to stick to an idealistic view.
|
|
|
|
|
I tried it the way SledgeHammer suggested, on the SelectedRecord (bound to the SelectedItem in the DG) I had a -= before the change to remove existing bindings and a += after the change, worked Ok.
Haven't tried POHs method but I would have no compunction shattering the MVVM design if it suited my needs .
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How to create multi focus in Surface application so multiple users can use application togather on sur 40?
Multiple keyboards for all users, and each user can use own virtual keyboard?
|
|
|
|
|
have used a RadTileView,
<usercontrol
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
="" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns ="http://schemas.microsoft.com/expression/blend/2008" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" x:class="DemoShow.usercontrol.UserControl1" mc:ignorable="d">
<usercontrol.resources>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="true">
<Setter Property="BorderThickness" Value="1,1,1,1" />
</trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="BorderThickness" Value="0,0,0,0"/>
</trigger>
</style.Triggers>
<datatemplate x:key="headerTemplate">
<textblock text="{Binding Number}">
<datatemplate x:key="contentTemplate">
<grid margin="5">
<grid.rowdefinitions>
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<rowdefinition height="Auto">
<textbox grid.row="0" style="{StaticResource TextBoxThumb}" isenabled="{Binding Path=ShowFlag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" text="{Binding Name,Mode=TwoWay}">
<textbox grid.row="1" style="{StaticResource TextBoxThumb}" isenabled="{Binding Path=ShowFlag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" text="{Binding Birthday,Mode=TwoWay}">
<textbox grid.row="2" style="{StaticResource TextBoxThumb}" isenabled="{Binding Path=ShowFlag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" text="{Binding age,Mode=TwoWay}">
<textbox grid.row="3" style="{StaticResource TextBoxThumb}" isenabled="{Binding Path=ShowFlag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" text="{Binding Sex,Mode=TwoWay}">
<textbox grid.row="4" style="{StaticResource TextBoxThumb}" isenabled="{Binding Path=ShowFlag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" text="{Binding CheckType,Mode=TwoWay}">
<textbox grid.row="5" style="{StaticResource TextBoxThumb}" isenabled="{Binding Path=ShowFlag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" text="{Binding Time,Mode=TwoWay}">
<i:interaction.triggers>
<i:eventtrigger eventname="Click">
<i:invokecommandaction command="{Binding DataContext.LoginCommand,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}, AncestorLevel=1}}"
="" commandparameter="{Binding Name}">
<grid>
<telerik:radtileview
="" isautoscrollingenabled="True" isdockingenabled="True" isvirtualizing="True" columnscount="2" rowheight="200" columnwidth="300" minimizedcolumnwidth="300" minimizedrowheight="200" minimizeditemsposition="Bottom" contenttemplate="{StaticResource contentTemplate}" itemssource="{Binding Path=Items,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" itemtemplate="{StaticResource headerTemplate}" preservepositionwhenmaximized="False" tilestatechangetrigger="SingleClick">
i change the BindingList<people>
public class MainViewModel : ViewModelBase
{
private BindingList<people> items;
private BindingList<people> itemstem;
public ICommand LoginCommand
{
get
{
return new RelayCommand<object>(
(parameter) =>
{
ChangeInputEnable(parameter);
}
);
}
}
ui not update public class People
{
public string Name { get; set; }
public string Birthday { get; set;}
public string age { get; set; }
public string Sex { get; set; }
public string CheckType { get; set; }
public string Time { get; set; }
public string Number { get; set; }
public bool ShowFlag { get; set; }
}
private void ChangeInputEnable(object parameter)
{
//string str = parameter.ToString();
//var obj = items.FirstOrDefault(x => x.Name == str);
//int n = items.IndexOf(obj);
//MessageBox.Show(items[n].ShowFlag.ToString());
//if (obj != null)
//{
// if (obj.ShowFlag) obj.ShowFlag = false;
// else obj.ShowFlag = true;
// RaisePropertyChanged("ShowFlag");
// RaisePropertyChanged("Items");
// MessageBox.Show(items[n].ShowFlag.ToString());
// MessageBox.Show(str);
//}
string str = parameter.ToString();
var obj = items.FirstOrDefault(x => x.Name == str);
int n = items.IndexOf(obj);
if (obj != null)
{
if (obj.ShowFlag) obj.ShowFlag = false;
else obj.ShowFlag = true;
obj.Name += "tttt";
items.ListChanged += (o, e) => RaisePropertyChanged(("Items"));
itemstem = items;
items = null;
items = itemstem;
RaisePropertyChanged("Name");
RaisePropertyChanged("Items");
}
//items.Add(new People()
//{
// Birthday = "1985-08-08",
// age = "38",
// Sex = "Male",
// CheckType = "PET-CT",
// Time = "10:30",
// Name = "tttt",
// Number = "10"
//});
//RaisePropertyChanged("Items");
}
public MainViewModel()
{
List<people> itemsSource = new List<people>();
for (int i = 0; i < 5; i++)
{
itemsSource.Add(new People()
{
Birthday = "1985-08-08",
age = "38",
Sex = "Male",
CheckType = "PET-CT",
Time = "10:30",
Name = this.names[i % 12],
Number = i.ToString(),
ShowFlag =true
});
}
this.items = new BindingList<people>(itemsSource);
}
public BindingList<people> Items
{
get
{
return this.items;
}
set
{
this.items =value;
RaisePropertyChanged("Items");
}
}
private List<string> names = new List<string>
{
"Andrew Fuller",
"Martin Sommer",
"Anne Dogsworth",
"Steven Buchanan",
"Janet Leverling",
"Michael Suyama",
"Margaret Peacock",
"Robert King",
"John Steel",
"Laura Gallahan",
"Nancy Davolio",
"Ann Devon"
};
}
can you help me ?
|
|
|
|
|
lijizhe wrote: can you help me ? Not until you format your code properly, and add a detailed explanation of your problem.
Veni, vidi, abiit domum
|
|
|
|
|
i have a radscheduler in my wpf application i want to create apointment from another window programatically i have tried iappointment but it shows there is no resources, how can i set a resource for iappointment for radscheduleview.
|
|
|
|
|
I reckon the answer is in here[^].
|
|
|
|
|
I'm working on a WFP/MVVM app that hast portions that need to run on a Windows 8 tablet.
Some parts of the app are not responding to touch. Buttons do, but grid row selection and other controls do not.
I'm brand new to working with touch. My understanding is that if you don't handle the touch event, it's promoted to a click.
I can trap Touch Down/Up in the code behind. But that doesn't help with my Grid.SelectedItem in an MVVM environment.
Anyone have any experience here that can point me in the right direction?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Did you use ManipulationStarted & ManipulationCompleted event?. Try this once.
|
|
|
|