Telerik Forums
UI for WPF Forum
1 answer
395 views

I am using a GRadGridView("CustomerRadGrid") which is initially bounded to a empty ObservableCollection(CustomerCollection) and RadButton. The User should be able to add Rows to the Grid and Add Button ("AddCustomerBttn") adds all rows with user entered values to the ObservableCollection(CustomerCollection). I was able to get the value of the Fisrt Cell with this code.

string custName = row.ChildrenOfType<GridViewCell>().Where(c => c.Column.UniqueName == "CustomerName").FirstOrDefault().Value.ToString();

How to get value of GridViewDataColumn(CheckBox) in ViewModel?

View

<telerik:RadGridView ItemsSource="{Binding CustomerCollection,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"

                                         AutoGenerateColumns="False"

                                         CanUserInsertRows="True" ShowInsertRow="True"

                                         Name="CustomerRadGrid">

<telerik:GridViewMaskedTextBoxColumn UniqueName="CustomerName" Header="Name"  DataMemberBinding="{Binding FirstName}"                                                                  MaskType="None"/>

<telerik:GridViewDataColumn UniqueName="IsMail">

   <telerik:GridViewDataColumn.Header>

      <StackPanel>

          <TextBlock Text="Mailing and Shipping Address Same?" />

      </StackPanel>

</telerik:GridViewDataColumn.Header>

<telerik:GridViewDataColumn.CellTemplate>

      <DataTemplate>

         <StackPanel HorizontalAlignment="Center">

            <CheckBox IsChecked="{Binding Path=IsAddressesSame, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/ >

         </StackPanel>

       </DataTemplate>

</telerik:GridViewDataColumn.CellTemplate>

</telerik:GridViewDataColumn>

</telerik:RadGridView>

<telerik:RadButton Name="AddCustomerBttn" Content="Add"

 Command="{Binding AddCustomerCommand

CommandParameter="{Binding ElementName=CustomerRadGrid}"/>

Model

 public class Customer : ViewModel.ViewModelBase

    {

        string name;

        public string Name //Product

        {

            get { return name; }

            set { name = value; NotifyPropertyChanged("Name"); }

        }

        bool isAddressesSame;

        public bool IsAddressesSame

        {

            get { return IsAddressesSame; }

            set { IsAddressesSame = value;NotifyPropertyChanged("IsAddressesSame "); }

        }

       

    }

}

ViewModel:

ObservableCollection<Customer> customerCollection = new ObservableCollection<Customer>();

        public ObservableCollection<Customer> CustomerCollection

        {

            get { return customerCollection; }

            set { customerCollection = value; NotifyPropertyChanged("CustomerCollection"); }

        }

  #region AddCustomerCommand  //Add

  public ICommand AddCustomerCommand { get; private set; }

  public HomeViewModel()

       {

AddCustomerCommand = new RelayCommand(Execute_AddCustomerCommand, CanExecute_AddCustomerCommand);

}

        public void Execute_AddCustomerCommand (object parameter)

        {

            RadGridView rGridView = (RadGridView)parameter;

           

            IList<GridViewRow> gViewRows = rGridView.ChildrenOfType<GridViewRow>().ToList();

            foreach (GridViewRow row in gViewRows)

            {

                string custName = row.ChildrenOfType<GridViewCell>().Where(c => c.Column.UniqueName == "CustomerName").FirstOrDefault().Value.ToString();

bool addressSame ;//Get Value from the .

//How to get value from GridViewDataColumn CheckBox(True if checked, False if unchecked)

                Customer temp = new Customer()

                {

                    Name = custName,

                    IsAddressSame = addressSame

                };

CustomerCollection.Add(temp);

            }         

           

        }

        public bool CanExecute_AddCustomerCommand (object parameter)

        {

                return true;

        }

        #endregion

Thank you,

-Prathibha

Dimitrina
Telerik team
 answered on 13 Aug 2012
1 answer
300 views
Hi.

I have a treeview with 3 levels in depth, first time everything looks fine, but when adding to a lower level then the root, it's not reflected.

<telerik:RadTreeView  Margin="8" ItemsSource="{Binding treeRoot}" ItemTemplate="{StaticResource Level1Template}" IsLineEnabled="True" SelectionChanged="JobDesign_SelectionChanged" x:Name="JobDesign"/>

These are my templates
<HierarchicalDataTemplate x:Key="Level3Template">
            <TextBlock Text="{Binding Name}" />
        </HierarchicalDataTemplate>
 
        <HierarchicalDataTemplate x:Key="Level2Template" ItemTemplate="{StaticResource Level3Template}" ItemsSource="{Binding Level3}" >
            <TextBlock Text="{Binding Name}" />
        </HierarchicalDataTemplate>
 
 
        <HierarchicalDataTemplate x:Key="Level1Template" ItemTemplate="{StaticResource Level2Template}" ItemsSource="{Binding Level2}" >
            <TextBlock Text="{Binding Name}" />
        </HierarchicalDataTemplate>


This is my Level1 class

public class Level1
    {
        public Level1()
        {
            this.Level2 = new List<Level2>();
        }
        public string Name
        {
            get;
            set;
        }
        public List<Level2> Level2
        {
            get;
            set;
        }
    }

level 2 and 3 are basicly the same

in the viewmodel file this it treeRoot:
public ObservableCollection<Level1> treeRoot { get; private set; }

when add items directly to treeRoot there is no problem.

But if I try to update in level2 like this:

Level1 jobPlanning = treeRoot.Where(t => t.Name.Equals("Job Planning")).Single();
            jobPlanning.Level2 = new List<Level2>();
 
                Level2 operation = new Level2()
                {
                    Name = "New Item"
                };
this.OnPropertyChanged(() => this.treeRoot);

But the treeview is not updated, what am I missing?
After I have add I can look in treeView and see that the new item has been added, but just not displayed.

Please help me.
Regards
Rune

Rune
Top achievements
Rank 1
 answered on 11 Aug 2012
5 answers
240 views
Is it possible to restore the original configuration of a RadDocking through code behind (panels, windows shrink, etc) after the user has "played" and changed the location and properties of these objects?

Ie set through code how the window was originally.

thanks
Lancelot
Top achievements
Rank 1
 answered on 10 Aug 2012
1 answer
48 views
I recently upgraded the dlls to the latest version (from q1) and now the chart is drawing... interesting lines when I zoom as much as I can and I'm at the end of the graph. Pics attached. Tried it on the q1 dlls and it doesn't do this. 
Yavor
Telerik team
 answered on 10 Aug 2012
0 answers
226 views

Hi Team,
I am using WPF  Radlistbox with MVVM pattern,

Here is my code.

<

 

 

Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem">

 

<

 

 

Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />

 

</

 

 

Style>

 

 

 

 

 

<telerik:RadListBox>

 

 

 

 

<

 

 

telerik:RadListBox.DragVisualProvider>

 

<

 

 

telerik:ScreenshotDragVisualProvider />

 

</

 

 

telerik:RadListBox.DragVisualProvider>

 

<

 

 

telerik:RadListBox.DragDropBehavior>

 

<

 

 

telerik:ListBoxDragDropBehavior />

 

</

 

 

telerik:RadListBox.DragDropBehavior>

 

 

 

 

 

 

</

telerik:RadListBox>



 

I have source listbox and target listbox,
1 ) while drag and drop items from source listbox to target , the draged items from source should not be removed.
2) Taget List box should not allow any duplicate item(s) to drop.
these conditions should be same for single selection and Multiselection
3) Drag and drop on Source listbox  should be disabled.

along with I need the follwing features for Radlist box.

1)Multi-select available on BOTH sides and on all operations (right click, add, drag n drop) available
2)Multi-select is “sticky” (ie don’t need to use Ctrl) with reset button (clear selections). Add or double click operation will also reset.
3)Use of Shift+click will select everything in between last select.
4)Either box could have multiple columns (in which headings are needed)
5)Enable Right Clik
6)To reorder right side
7)Items selected on the right, still appear on the left
8)Add button is sometimes available
9)Double-click on left side does an add (one line only), on right side does a remove (one line only)
10???Filter (sometimes available), generally radio button with the first (default) option being “All”. This allows for “one” click switching between (for example Bcast and cable)

Can any one help me to resolve these features.
Thanks
Suresh.S

Suresh
Top achievements
Rank 1
 asked on 10 Aug 2012
1 answer
171 views
Hi,

I am using the RadGridView throughout my application.
I have implemented the IDataError interface for all items that the RadGridViews are binding to.

I hope to set the RadGridVIews ValidatesOnDataErrors="InEditMode" so that validation issues are only apparent when the user is editing something.

However, when the user clicks the "Save" button, I retrieve a bunch of custom validation errors raised in my save logic and some of these validation errors may pertain to items being displayed in the RadGridView.

In this case, I would like to be able to show validation errors InViewMode.

How do I accomplish this?

Thanks

-Rebecca
Rebecca
Top achievements
Rank 1
 answered on 10 Aug 2012
1 answer
127 views
Hello Telerik,

I currently have SelectedItem of timeline bound to an object. I am able to populate my object right left click and then performing whatever action I need to do.

Is there a way to have the item selection occuring on Mouse hover?

What I am trying to do is right click on an item (without first left clicking to select it) to invoke an instruction on the "selecteditem".

I can see that there is logic occuring when hoving over an item because the tooltip occurs as well as the selection highlight border.


Tsvetie
Telerik team
 answered on 10 Aug 2012
1 answer
298 views

How can I disable cell selection or remove selected cell border in GridView.

Vanya Pavlova
Telerik team
 answered on 10 Aug 2012
1 answer
91 views
Hello,

I have a RadGridView with a GridViewDataColumn which has a DateTime type in UTC time. In the filter I changed the DateTime picker to show time also. However, the filter times are off by a few hours since the filter works on local time while the displayed times are in UTC.

Is there any way I can tell the filter to change the filter critrion to UTC time ?

Thanks,
Chait
Vlad
Telerik team
 answered on 10 Aug 2012
4 answers
244 views
Hello,

I was wondering if the Timeline control is good for using as an video editor. I need a line that cross verticaly the component, which I can use to seek for the current crossed files (displayed as events). I can find the corretly position by using the start_time of the event and the current position of that line and display exactly the part of the file that i need, but.I can't figure out how do I insert that crossed line into the component.

Another solution might be using the TimeBar component instead, but with that component I can't browse more than one stream in the same time, or I did't find an way of doing that.

Thanks!

Eng. Marcelo



Marcelo
Top achievements
Rank 1
 answered on 10 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?