This is a migrated thread and some comments may be shown as answers.

Add and Remove Items...

15 Answers 418 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 21 Mar 2013, 03:04 PM
Hi,

i use the RadTabControl (latest Version). My problem is this. I want to add items with a button outside the rabtab-control.
And i want to remove the item by clicking on a "x" on the TabItem. How is this possible? I just find examples to do this in
the tabcontrol itself,

Thanks
best Regards
Rene

15 Answers, 1 is accepted

Sort by
0
Kiril Vandov
Telerik team
answered on 26 Mar 2013, 03:18 PM
Hello Rene,

I created a sample project using MVVM pattern demonstrating how to dynamically add items to the ItemSource of a RadTabControl from a static button.

For the implementation we need to create:
- Two view models: one for the TabItem object(TabItemViewModel) and one MainViewModel containing the collection of TabItems and an AddTabCommand DelegateCommand.
- The TabViewModel consist of RemoveTab Command and properties we want our custom tab to have.
- Custom ItemTemplate in order to display the TabItems.

Finally I attached the project for your convenience. Please take a look at it and let us know if this is what you had in mind.

Kind regards,
Kiril Vandov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 05 Apr 2013, 10:37 AM
Hi,

this is great, thanks so much. but one more question. If I have two, three or more buttons, is it possible to get the x:Name of
the button which was pressed to add a new TabItem?

<telerik:RadButton Content="AddTabItem" Command="{Binding AddItemCommand}" ToolTipService.ToolTip="Add new item" Margin="10" x:Name="Test" />
 
<telerik:RadButton Content="AddTabItem" Command="{Binding AddItemCommand}" ToolTipService.ToolTip="Add new item" Margin="10" x:Name="Test 1" />
 
<telerik:RadButton Content="AddTabItem" Command="{Binding AddItemCommand}" ToolTipService.ToolTip="Add new item" Margin="10" x:Name="Test 2" />

The Header in your example is:"newTabItem.Header = "New Tab " + counter;". But I want the Name of the Button I pressed?

A Second question is: How do I add a control to the new TabItem? I want to add a Tab for Purchasing, one for MasterData,... ?

Is this possible?

Thanks Best Regards
Rene
0
Kiril Vandov
Telerik team
answered on 10 Apr 2013, 12:07 PM
Hello Rene,

Using the MVVM approach does not gives us access to the x:Name of the pressed button. However we can use the CommandParameter property and set different parameters for each button. Also we will need to change our command a little in order to accept the parameter, like follows:
this.AddItemCommand = new DelegateCommand((parameter)=>
{
    this.AddItem(null, parameter);
},
delegate
{
    return true;
});
and change the AddItem method to take into account the parameter.

As for adding a UserControl, we could use the ContentTemplateSelector property of the RadTabControl. This way we can define different DataTemplates and based on custom logic to select one template or another. You can read more about ContentTemplateSelectors in this article.

I created a property in our TabViewModel class called Content and based on its value I am selecting different DataTemplates. I also defined two DataTemplates located in the App.xaml file.

Finally I attached the modified project for your convenience. I hope this information helps.

Kind regards,
Kiril Vandov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 10 Apr 2013, 12:39 PM
Hi,

i just love ypu...

Thanks Best Regards
Rene
0
ITA
Top achievements
Rank 1
answered on 10 Apr 2013, 03:04 PM
Hi,

sorry done!!!!!


Thanks a lot
0
ITA
Top achievements
Rank 1
answered on 30 Apr 2013, 01:37 PM
Hi,

one more Problem!

I load a new TabItem with a new UserControl. In this Tab I select a customer and display the Data in a RadDataForm.
When I select an other TabItem and come back to the first one with the Customer the RadDataForm ist empty!
Why does the UserControl reload in the TabItem? How do I solve this Problem?

Thanks Best Regards
RENE
0
Kiril Vandov
Telerik team
answered on 03 May 2013, 12:03 PM
Hello Rene,

By default the RadTabControl only keeps the Content for its SelectedTab. After the selection is changed the Content of the last active TabItem is unloaded and that is why the content does not keep its state. However you can use the RadTabControl IsContentPreserved property which loads the TabItems and does not unload them after the selection is changed. For more information about the IsContentPreserved property you could take a look at this article.

I hope this information helps.

Kind regards,
Kiril Vandov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 10 May 2013, 07:54 AM
Hi,

thanks a lot. One last question. In this case, how do i add a new TabItem out of the Usercontrol on one tab?

Example:
MainWindow - Button Add a TabItem = OK, In this TabItem I load a UserControl. Now I click on a Button in this
usercontrol, button: Command="{Binding AddItemCommand}" CommandParameter="MenueKundenkontakt"

I reach the void: public void AddItem(TabViewModel sender, object commandParams) and a get no errors,
but the new Item will not be displayed?

The Problem is, that i have to use your example (RadTabControl-BindingDemoContentSelector.zip)
where i use the MainViewModel as Datacontext of the MainWindow!


Thanks
Best Regards
Rene
0
Kiril Vandov
Telerik team
answered on 14 May 2013, 11:59 AM
Hi Rene,

The command is not executed because the UserControl is wrapped in TabItem and its DataContext is a TabViewModel. The AddItemCommand is in our MainViewModel and that is why it is inaccessible from the UserControl. We could add new command in out TabViewModel which will call the AddItem function from out MainViewModel like we did with the RemoveItemCommand.

I attached the modified project for your convenience. I hope this information helps.

Kind regards,
Kiril Vandov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 06 Jun 2013, 11:45 AM
Hi,

this is nearly perfect. One last question to this issue. How do I add a new TabITem out of a RadGridView which is in
an RadDataform on a usercontrol of one TabItem?
It works great if the button is out of the Dataform in the usercontrol.

Thanks
Best Regards
Rene
0
Kiril Vandov
Telerik team
answered on 11 Jun 2013, 07:22 AM
Hello Rene,

I am not quite sure that I understand the structure of your xaml (how exactly the controls are nested). That is why I would like to ask you for more information about your scenario. It would be great if you could modify the project from our previous post to better demonstrate your approach and send it over.

Thank you for your cooperation.

Kind regards,
Kiril Vandov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 11 Jun 2013, 12:38 PM
Hi,

it is quiet simple. In your last example out of this thread you have shown me how to add a new TabItem out of a user control.
No I want to add e new tab item out of this user control, but in this control I placed a RadDataForm with a RadGRidView
and I want to add a new Tab out of one GridView row clicking on a button!

Thanks
best regards
rene
0
Kiril Vandov
Telerik team
answered on 13 Jun 2013, 03:46 PM
Hello Rene,

In order to provide you with the best solution I would like to ask you for a little more information:
- are you placing the RadGridView inside the RadDataForm by setting the AutoGenerateFields property of the RadDataForm to False and overriding the ReadOnlyTemplate, EditTemplate and NewItemTemplate templates.
- are you using ViewModels to populate the data in the RadDataForm and the RadGridView.
- is it possible for you to provide us with a code snippet or a screenshot demonstrating your setup in more details.

We need to know the RadDataForm and RadGridView definitions and the ViewModels that populate them so that we can suggest how and where to define a command for the buttons displayed within the RadGridView. We also need to know how the ViewModels that describe the DataForm and GridView data are related to the main ViewModel where the RadTabControl is defined. This will help us better understand what kind of logic can add a new tab.

Thank you for your cooperation.

Kind regards,
Kiril Vandov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 20 Jun 2013, 06:04 AM
Hi,

to your questions:

- yes i do provide the RadGridView in the RadDataForm by setting the AutoGenerateFields property to false and
overriding the ReadOnlyTemplate, EditTemplate and NewItemTemplate.
- yes i use a ViewModel to populate the data in RadDataForm and the RadGRidView.

UserControl:

<UserControl x:Class="ITA_ERP2go.Controls.User.User"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
             xmlns:local="clr-namespace:ITA_ERP2go.Controls.User"
             xmlns:Lang="clr-namespace:ITA_ERP2go.ViewModel"
             xmlns:ff="clr-namespace:ITA_ERP2go.Klassen"
             Loaded="UserControl_Loaded"  mc:Ignorable="d" Background="Transparent"
             d:DesignHeight="768" d:DesignWidth="1024">
    <UserControl.Resources>
        <local:AutoCompleteViewModel x:Key="users" />       
        <Lang:SprachenViewModel x:Key="Spr" />
    </UserControl.Resources>
    <Grid Name="UserMainOuter">
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <!-- KOPFZEILE -->
        <Border Grid.Row="0" Background="#f2f2f2">
            <Grid>
                <telerik:RadToolBar HorizontalAlignment="Stretch" MinWidth="510" telerik:StyleManager.Theme="Windows8Touch" HorizontalContentAlignment="Stretch"
                                    VerticalContentAlignment="Top">
                    <StackPanel x:Name="LeftColumn" Grid.Row="1" Grid.Column="0" Width="250" Margin="5,0,0,0" Height="35">
                        <telerik:RadAutoCompleteBox  HorizontalAlignment="Stretch" Margin="0" Height="35" SelectionMode="Single" VerticalContentAlignment="Center"
                                                WatermarkContent="{Binding Source={StaticResource Lang}, XPath=MaskSuchBoxWater/@Header}" FontFamily="Calibri" FontSize="14" Padding="3,5,3,3"
                                                TextSearchMode="Contains" Name="UserAutoCompleteBox"
                                                TextSearchPath="Suchwort" AutoCompleteMode="Suggest"                                                    
                                                ItemsSource="{Binding ContactsList, Source={StaticResource users}}" />
                    </StackPanel>
                    <telerik:RadButton Margin="5,0,5,0" x:Name="zeigen_btn" Click="zeigen_btn_Click" Height="30" Background="#FF26A0DA">
                        <StackPanel Orientation="Vertical">
                            <Image ToolTipService.ToolTip="{Binding Source={StaticResource Lang}, XPath=MaskBTNZeigen/@Header}" Height="30" Width="30" Margin="0,3,0,5" Source="/ITA-ERP2go;component/Style/Images/suchen.png" Stretch="Uniform"/>
                        </StackPanel>
                    </telerik:RadButton>
                    <telerik:RadToolBarSeparator BorderThickness="1" Width="1" Background="#25a0da" Margin="10,0,10,0" />                   
                </telerik:RadToolBar>
            </Grid>
        </Border>
        <!-- Form -->
        <Grid Grid.Row="1" Name="MeinKundenInner">
            <Grid.Resources>
                <DataTemplate x:Key="MyTemplate">
                    <telerik:RadTabControl telerik:StyleManager.Theme="Windows8" BorderThickness="0" Margin="10">
                        <telerik:RadTabItem Header="{Binding Source={StaticResource Lang}, XPath=TabUser/@Header}" IsSelected="True">
                            <telerik:RadTabItem.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto" />
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <!-- Ãœberschrift -->
                                    <Border Grid.Row="0" Grid.ColumnSpan="2" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <StackPanel Orientation="Vertical">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="auto" />
                                                    <RowDefinition Height="auto" />
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="50" />
                                                    <ColumnDefinition Width="350" />
                                                    <ColumnDefinition Width="350" />
                                                </Grid.ColumnDefinitions>
                                                <Image Source="/ITA-ERP2go;component/Style/Images/user.png" Height="30" Width="30" Grid.Column="0" />
                                                <telerik:DataFormDataField DataMemberBinding="{Binding Suchwort, Mode=TwoWay}" Grid.Column="1" Width="350" Foreground="Black">
                                                    <telerik:DataFormDataField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenSuchwort/@Header}" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormDataField.LabelTemplate>
                                                </telerik:DataFormDataField
                                                <telerik:DataFormDataField  DataMemberBinding="{Binding Id, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="2">
                                                    <telerik:DataFormDataField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Identnummer/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormDataField.LabelTemplate>
                                                </telerik:DataFormDataField>
                                                <telerik:DataFormCheckBoxField DataMemberBinding="{Binding Aktiv, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="1" Grid.Row="1">
                                                    <telerik:DataFormCheckBoxField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Aktiv/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormCheckBoxField.LabelTemplate>
                                                </telerik:DataFormCheckBoxField>
                                                <telerik:DataFormComboBoxField Grid.Row="1" Grid.Column="2"  Foreground="Black" DataMemberBinding="{Binding Bediensprache, Mode=TwoWay}" SelectedValuePath="ID" DisplayMemberPath="Name"
                                                                               ItemsSource="{Binding Sprache, Source={StaticResource Spr}}">
                                                    <telerik:DataFormComboBoxField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Bediensprache/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormComboBoxField.LabelTemplate>
                                                </telerik:DataFormComboBoxField>
                                            </Grid>
                                        </StackPanel>
                                    </Border>                                   
                                    <!-- Username,Passwort,name,aktiv,ablaufdatum ,email,tele,mtele,Mitarbeiter,Bediensprache -->
                                    <Border Grid.Row="1" Grid.Column="0" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3" Width="380">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Username, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Username/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Name/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDateField Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Ablaufdatum, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDateField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Ablaufdatum/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDateField.LabelTemplate>
                                            </telerik:DataFormDateField>
                                            <telerik:DataFormDataField  Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
                                                <PasswordBox x:Name="PasswordBox" ff:PasswordBoxAssistant.BindPassword="true" ff:PasswordBoxAssistant.BoundPassword="{Binding Path=Passwort, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                             Height="30" Margin="0,5,0,5" IsEnabled="False" Padding="3"/>
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Passwort/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>                                           
                                            </telerik:DataFormDataField>
                                        </Grid>
                                    </Border>
                                    <Border Grid.Row="1" Grid.Column="1" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Email, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Email/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Telefon, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenTelefon/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Mobil, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenMTelefon/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Mitarbeiter, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Mitarbeiter/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>                                           
                                        </Grid>                                       
                                    </Border>
                                </Grid>
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>
                        <telerik:RadTabItem Header="{Binding Source={StaticResource Lang}, XPath=TabUserRollen/@Header}">
                            <telerik:RadTabItem.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <!-- Ãœberschrift -->
                                    <Border Grid.Row="0" Grid.ColumnSpan="2" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />                                                           
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="50" />
                                                <ColumnDefinition Width="350" />
                                                <ColumnDefinition Width="350" />
                                            </Grid.ColumnDefinitions>
                                            <Image Source="/ITA-ERP2go;component/Style/Images/user.png" Height="30" Width="30" Grid.Column="0"  />
                                            <telerik:DataFormDataField DataMemberBinding="{Binding Suchwort, Mode=TwoWay}" Grid.Column="1" Width="350" Foreground="Black">
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenSuchwort/@Header}" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField  DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="2">
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Bezeichnung/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                        </Grid>                                       
                                    </Border>
                                    <!-- Rollen -->
                                    <Border Grid.Row="1" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <telerik:RadGridView telerik:StyleManager.Theme="Windows8" GridLinesVisibility="None" Margin="0" CanUserSortColumns="True" CanUserInsertRows="False"
                                                         RowIndicatorVisibility="Collapsed" IsReadOnly="False" RowHeight="35" CanUserFreezeColumns="False" CanUserResizeColumns="True" Name="RollenGrd"
                                                         ItemsSource="{Binding _usercoll}" AutoGenerateColumns="False" Width="{Binding ElementName=UserForm, Path=ActualWidht}">                                                        
                                            <telerik:RadGridView.Columns>
                                                <telerik:GridViewDataColumn Header="Rollen-ID" DataMemberBinding="{Binding RollenID}" Width="80"  IsReadOnly="True" />
                                                <telerik:GridViewDataColumn Header="Bezeichnung" DataMemberBinding="{Binding Name}" Width="200"  IsReadOnly="True" />
                                                <telerik:GridViewColumn Header="{Binding Source={StaticResource Lang}, XPath=Details/@Header}" Width="50">
                                                    <telerik:GridViewColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <telerik:RadButton Margin="3" x:Name="details_btn" Height="30" Background="#FF26A0DA" Click="details_btn_Click" CommandParameter="{Binding RollenID}"
                                                                               Command="{Binding AddTabCommand}">                                                                              
                                                                <StackPanel Orientation="Vertical">
                                                                    <Image ToolTipService.ToolTip="{Binding Source={StaticResource Lang}, XPath=Detailszeigen/@Header}" Height="25" Width="25" Margin="0,3,0,5" Source="/ITA-ERP2go;component/Style/Images/suchen.png" Stretch="Uniform"/>
                                                                </StackPanel>
                                                            </telerik:RadButton>
                                                        </DataTemplate>
                                                    </telerik:GridViewColumn.CellTemplate>
                                                </telerik:GridViewColumn>
                                            </telerik:RadGridView.Columns>
                                        </telerik:RadGridView>
                                    </Border>
                                </Grid>
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>
                    </telerik:RadTabControl>
                </DataTemplate>
                <DataTemplate x:Key="MyEditTemplate">
                    <telerik:RadTabControl telerik:StyleManager.Theme="Windows8" BorderThickness="0" Margin="10">
                        <telerik:RadTabItem Header="{Binding Source={StaticResource Lang}, XPath=TabUser/@Header}" IsSelected="True">
                            <telerik:RadTabItem.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto" />
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <!-- Ãœberschrift -->
                                    <Border Grid.Row="0" Grid.ColumnSpan="2" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <StackPanel Orientation="Vertical">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="auto" />
                                                    <RowDefinition Height="auto" />
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="50" />
                                                    <ColumnDefinition Width="350" />
                                                    <ColumnDefinition Width="350" />
                                                </Grid.ColumnDefinitions>
                                                <Image Source="/ITA-ERP2go;component/Style/Images/user.png" Height="30" Width="30" Grid.Column="0" />
                                                <telerik:DataFormDataField DataMemberBinding="{Binding Suchwort, Mode=TwoWay}" Grid.Column="1" Width="350" Foreground="Black">
                                                    <telerik:DataFormDataField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenSuchwort/@Header}" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormDataField.LabelTemplate>
                                                </telerik:DataFormDataField>
                                                <telerik:DataFormDataField  DataMemberBinding="{Binding Id, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="2" x:Name="Userid" IsReadOnly="True">
                                                    <telerik:DataFormDataField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Identnummer/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormDataField.LabelTemplate>
                                                </telerik:DataFormDataField>
                                                <telerik:DataFormCheckBoxField DataMemberBinding="{Binding Aktiv, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="1" Grid.Row="1">
                                                    <telerik:DataFormCheckBoxField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Aktiv/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormCheckBoxField.LabelTemplate>
                                                </telerik:DataFormCheckBoxField>
                                                <telerik:DataFormComboBoxField Grid.Row="1" Grid.Column="2"  Foreground="Black" DataMemberBinding="{Binding Bediensprache, Mode=TwoWay}" SelectedValuePath="ID" DisplayMemberPath="Name"
                                                                               ItemsSource="{Binding Sprache, Source={StaticResource Spr}}">
                                                    <telerik:DataFormComboBoxField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Bediensprache/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormComboBoxField.LabelTemplate>
                                                </telerik:DataFormComboBoxField>
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                    <!-- Username,Passwort,name,aktiv,ablaufdatum ,email,tele,mtele,Mitarbeiter,Bediensprache -->
                                    <Border Grid.Row="1" Grid.Column="0" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3" Width="380">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Username, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Username/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Name/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDateField Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Ablaufdatum, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDateField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Ablaufdatum/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDateField.LabelTemplate>
                                            </telerik:DataFormDateField>
                                            <telerik:DataFormDataField  Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
                                                <PasswordBox x:Name="PasswordBox" ff:PasswordBoxAssistant.BindPassword="true" ff:PasswordBoxAssistant.BoundPassword="{Binding Path=Passwort, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                             Height="30" Margin="0,5,0,5" IsEnabled="True" Padding="3"/>
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Passwort/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                        </Grid>
                                    </Border>
                                    <Border Grid.Row="1" Grid.Column="1" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Email, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Email/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Telefon, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenTelefon/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Mobil, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenMTelefon/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Mitarbeiter, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Mitarbeiter/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:RadButton Margin="10,0,0,0" x:Name="suchen_btn" Click="suchen_btn_Click" Background="#FF26A0DA" Height="25" Width="25" Padding="2" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left">
                                                <StackPanel Orientation="Horizontal">
                                                    <Image ToolTipService.ToolTip="{Binding Source={StaticResource Lang}, XPath=MaskBTNZeigen/@Header}" Height="20" Width="20" Margin="0" Source="/ITA-ERP2go;component/Style/Images/suchen.png" Stretch="Uniform"/>
                                                </StackPanel>
                                            </telerik:RadButton>
                                        </Grid>
                                    </Border>
                                </Grid>
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>
                        <telerik:RadTabItem Header="{Binding Source={StaticResource Lang}, XPath=TabUserRollen/@Header}" x:Name="ErlaubnisseTab">
                            <telerik:RadTabItem.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto" />
                                        <RowDefinition Height="auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <!-- Ãœberschrift -->
                                    <Border Grid.Row="0" Grid.ColumnSpan="2" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="50" />
                                                <ColumnDefinition Width="350" />
                                                <ColumnDefinition Width="350" />
                                            </Grid.ColumnDefinitions>
                                            <Image Source="/ITA-ERP2go;component/Style/Images/user.png" Height="30" Width="30" Grid.Column="0"  />
                                            <telerik:DataFormDataField DataMemberBinding="{Binding Suchwort, Mode=TwoWay}" Grid.Column="1" Width="350" Foreground="Black">
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenSuchwort/@Header}" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField  DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="2">
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Bezeichnung/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                        </Grid>
                                    </Border>
                                    <!-- Grid Navi -->
                                    <StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Left">
                                        <telerik:RadButton Width="auto" Command="telerikGrid:RadGridViewCommands.BeginInsert" CommandTarget="{Binding ElementName=RollenGrd}" Margin="10,0,0,0">
                                            <telerik:RadButton.Template>
                                                <ControlTemplate>
                                                    <Image Source="/ITA-ERP2go;component/Style/Images/addrow.png" Height="30" Width="30" />
                                                </ControlTemplate>
                                            </telerik:RadButton.Template>
                                        </telerik:RadButton>
                                        <telerik:RadButton Width="auto" Command="telerikGrid:RadGridViewCommands.Delete" CommandTarget="{Binding ElementName=RollenGrd}" Margin="10,0,0,0">
                                            <telerik:RadButton.Template>
                                                <ControlTemplate>
                                                    <Image Source="/ITA-ERP2go;component/Style/Images/deleterow.png" Height="30" Width="30" />
                                                </ControlTemplate>
                                            </telerik:RadButton.Template>
                                        </telerik:RadButton>
                                    </StackPanel>
                                    <!-- Rollen -->
                                    <Border Grid.Row="2" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <telerik:RadGridView telerik:StyleManager.Theme="Windows8" GridLinesVisibility="None" Margin="0" CanUserSortColumns="True" CanUserInsertRows="True"
                                                             RowIndicatorVisibility="Collapsed" IsReadOnly="False" RowHeight="35" CanUserFreezeColumns="False" CanUserResizeColumns="True" Name="RollenGrd"
                                                             ItemsSource="{Binding _usercoll}" AutoGenerateColumns="False" Width="{Binding ElementName=UserForm, Path=ActualWidht}"  ActionOnLostFocus="None"
                                                             KeyDown="RollenGrd_KeyDown" AddingNewDataItem="RollenGrd_AddingNewDataItem" Deleting="RollenGrd_Deleting" CellValidating="RollenGrd_CellValidating">
                                            <telerik:RadGridView.Columns>
                                                <telerik:GridViewDataColumn Header="Rollen-ID" DataMemberBinding="{Binding RollenID}" Width="80"  IsReadOnly="False" x:Name="RollenIDCell"/>
                                                <telerik:GridViewDataColumn Header="Bezeichnung" DataMemberBinding="{Binding Name}" Width="200"  IsReadOnly="false" x:Name="RollenNameCell" />
                                                <telerik:GridViewColumn Header="{Binding Source={StaticResource Lang}, XPath=Details/@Header}" IsReadOnly="True">
                                                    <telerik:GridViewColumn.CellTemplate>
                                                        <DataTemplate>
                                                            <telerik:RadButton Margin="3" x:Name="details_btn" Click="details_btn_Click" Height="30" Background="#FF26A0DA">
                                                                <StackPanel Orientation="Vertical">
                                                                    <Image ToolTipService.ToolTip="{Binding Source={StaticResource Lang}, XPath=Detailszeigen/@Header}" Height="25" Width="25" Margin="0,3,0,5" Source="/ITA-ERP2go;component/Style/Images/suchen.png" Stretch="Uniform"/>
                                                                </StackPanel>
                                                            </telerik:RadButton>
                                                        </DataTemplate>
                                                    </telerik:GridViewColumn.CellTemplate>
                                                </telerik:GridViewColumn>
                                            </telerik:RadGridView.Columns>
                                        </telerik:RadGridView>
                                    </Border>
                                </Grid>
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>
                    </telerik:RadTabControl>
                </DataTemplate>
                <DataTemplate x:Key="MyNewTemplate">
                    <telerik:RadTabControl telerik:StyleManager.Theme="Windows8" BorderThickness="0" Margin="10">
                        <telerik:RadTabItem Header="{Binding Source={StaticResource Lang}, XPath=TabUser/@Header}" IsSelected="True">
                            <telerik:RadTabItem.Content>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto" />
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <!-- Ãœberschrift -->
                                    <Border Grid.Row="0" Grid.ColumnSpan="2" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <StackPanel Orientation="Vertical">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="auto" />
                                                    <RowDefinition Height="auto" />
                                                </Grid.RowDefinitions>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="50" />
                                                    <ColumnDefinition Width="350" />
                                                    <ColumnDefinition Width="350" />
                                                </Grid.ColumnDefinitions>
                                                <Image Source="/ITA-ERP2go;component/Style/Images/user.png" Height="30" Width="30" Grid.Column="0" />
                                                <telerik:DataFormDataField DataMemberBinding="{Binding Suchwort, Mode=TwoWay}" Grid.Column="1" Width="350" Foreground="Black">
                                                    <telerik:DataFormDataField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenSuchwort/@Header}" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormDataField.LabelTemplate>
                                                </telerik:DataFormDataField>
                                                <telerik:DataFormDataField  DataMemberBinding="{Binding Id, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="2" x:Name="Userid" IsReadOnly="True">
                                                    <telerik:DataFormDataField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Identnummer/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormDataField.LabelTemplate>
                                                </telerik:DataFormDataField>
                                                <telerik:DataFormCheckBoxField DataMemberBinding="{Binding Aktiv, Mode=TwoWay}" Width="350"  Foreground="Black" Grid.Column="1" Grid.Row="1">
                                                    <telerik:DataFormCheckBoxField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Aktiv/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormCheckBoxField.LabelTemplate>
                                                </telerik:DataFormCheckBoxField>
                                                <telerik:DataFormComboBoxField Grid.Row="1" Grid.Column="2"  Foreground="Black" DataMemberBinding="{Binding Bediensprache, Mode=TwoWay}" SelectedValuePath="ID" DisplayMemberPath="Name"
                                                                               ItemsSource="{Binding Sprache, Source={StaticResource Spr}}">
                                                    <telerik:DataFormComboBoxField.LabelTemplate>
                                                        <DataTemplate>
                                                            <Label Content="{Binding Source={StaticResource Lang}, XPath=Bediensprache/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                        </DataTemplate>
                                                    </telerik:DataFormComboBoxField.LabelTemplate>
                                                </telerik:DataFormComboBoxField>
                                            </Grid>
                                        </StackPanel>
                                    </Border>
                                    <!-- Username,Passwort,name,aktiv,ablaufdatum ,email,tele,mtele,Mitarbeiter,Bediensprache -->
                                    <Border Grid.Row="1" Grid.Column="0" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3" Width="380">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Username, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Username/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Name, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Name/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDateField Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Ablaufdatum, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDateField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Ablaufdatum/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDateField.LabelTemplate>
                                            </telerik:DataFormDateField>
                                            <telerik:DataFormDataField  Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2">
                                                <PasswordBox x:Name="PasswordBox" ff:PasswordBoxAssistant.BindPassword="true" ff:PasswordBoxAssistant.BoundPassword="{Binding Path=Passwort, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                             Height="30" Margin="0,5,0,5" IsEnabled="True" Padding="3"/>
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Passwort/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                        </Grid>
                                    </Border>
                                    <Border Grid.Row="1" Grid.Column="1" Margin="10" BorderBrush="#FF26A0DA" BorderThickness="1" Background="#FFFBFBFB" CornerRadius="3">
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="auto" />
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                                <RowDefinition Height="auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition Width="*" />
                                                <ColumnDefinition Width="*" />
                                            </Grid.ColumnDefinitions>
                                            <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Email, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Email/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Telefon, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenTelefon/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Mobil, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=KundenMTelefon/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:DataFormDataField Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" DataMemberBinding="{Binding Mitarbeiter, Mode=TwoWay}" Width="380"  Foreground="Black" >
                                                <telerik:DataFormDataField.LabelTemplate>
                                                    <DataTemplate>
                                                        <Label Content="{Binding Source={StaticResource Lang}, XPath=Mitarbeiter/@Header}" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalContentAlignment="Center" />
                                                    </DataTemplate>
                                                </telerik:DataFormDataField.LabelTemplate>
                                            </telerik:DataFormDataField>
                                            <telerik:RadButton Margin="10,0,0,0" x:Name="suchen_btn" Click="suchen_btn_Click" Background="#FF26A0DA" Height="25" Width="25" Padding="2" Grid.Row="3" Grid.Column="2" HorizontalAlignment="Left">
                                                <StackPanel Orientation="Horizontal">
                                                    <Image ToolTipService.ToolTip="{Binding Source={StaticResource Lang}, XPath=MaskBTNZeigen/@Header}" Height="20" Width="20" Margin="0" Source="/ITA-ERP2go;component/Style/Images/suchen.png" Stretch="Uniform"/>
                                                </StackPanel>
                                            </telerik:RadButton>
                                        </Grid>
                                    </Border>
                                </Grid>
                            </telerik:RadTabItem.Content>
                        </telerik:RadTabItem>                       
                    </telerik:RadTabControl>
                </DataTemplate>
            </Grid.Resources>
            <telerik:RadDataForm telerik:StyleManager.Theme="Windows8Touch" Margin="10" Name="UserForm" AutoGenerateFields="False"
                                  ReadOnlyTemplate="{StaticResource MyTemplate}" EditTemplate="{StaticResource MyEditTemplate}" NewItemTemplate="{StaticResource MyNewTemplate}"
                                 Padding="10" EditEnded="UserForm_EditEnded" DeletingItem="UserForm_DeletingItem">
            </telerik:RadDataForm>
        </Grid>
        <!-- FUSSZEILE-->
        <Border Grid.Row="2" Background="#25a0da">
            <StackPanel Orientation="Horizontal">
                <TextBlock x:Name="MaskenStatus_txt"  VerticalAlignment="Center" FontFamily="Calibri" FontSize="14" Foreground="WhiteSmoke" Padding="10,0,10,0"/>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

View Model:
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Data;
 
namespace ITA_ERP2go.Controls.User
{
    public class DBUser : INotifyPropertyChanged
    {
        #region Properties
        #region Id (INotifyPropertyChanged Property)
        private Int64 _id;
        public Int64 Id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
                RaisePropertyChanged("Id");
            }
        }
        #endregion
 
        #region Suchwort (INotifyPropertyChanged Property)
        private string _suchw;
        public string Suchwort
        {
            get
            {
                return _suchw;
            }
            set
            {
                _suchw = value;
                RaisePropertyChanged("Suchwort");
            }
        }
        #endregion
 
        #region Identnummer (INotifyPropertyChanged Property)
        private string _ident;
        public string Identnummer
        {
            get
            {
                return _ident;
            }
            set
            {
                _ident = value;
                RaisePropertyChanged("Identnummer");
            }
        }
        #endregion
 
        #region AbasID (INotifyPropertyChanged Property)
        private string _abasid;
        public string AbasID
        {
            get
            {
                return _abasid;
            }
            set
            {
                _abasid = value;
                RaisePropertyChanged("AbasID");
            }
        }
        #endregion
 
        #region Mandant (INotifyPropertyChanged Property)
        private string _mand;
        public string Mandant
        {
            get
            {
                return _mand;
            }
            set
            {
                _mand = value;
                RaisePropertyChanged("Mandant");
            }
        }
        #endregion
 
        #region Name (INotifyPropertyChanged Property)
        private string _name;
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
                RaisePropertyChanged("Name");
            }
        }
        #endregion
 
        #region Aktiv (INotifyPropertyChanged Property)
        private Int64 _aktiv;
        public Int64 Aktiv
        {
            get
            {
                return _aktiv;
            }
            set
            {
                _aktiv = value;
                RaisePropertyChanged("Aktiv");
            }
        }
        #endregion
 
        #region Username (INotifyPropertyChanged Property)
        private string _username;
        public string Username
        {
            get
            {
                return _username;
            }
            set
            {
                _username = value;
                RaisePropertyChanged("Username");
            }
        }
        #endregion
 
        #region Passwort (INotifyPropertyChanged Property)
        private string _pass;
        public string Passwort
        {
            get
            {
                return _pass;
            }
            set
            {
                _pass = value;
                RaisePropertyChanged("Passwort");
            }
        }
        #endregion
 
        #region Ablaufdatum (INotifyPropertyChanged Property)
        private string _ablaufdatum;
        public string Ablaufdatum
        {
            get
            {
                return _ablaufdatum;
            }
            set
            {
                _ablaufdatum = value;
                RaisePropertyChanged("Ablaufdatum");
            }
        }
        #endregion
 
        #region Email (INotifyPropertyChanged Property)
        private string _email;
        public string Email
        {
            get
            {
                return _email;
            }
            set
            {
                _email = value;
                RaisePropertyChanged("Email");
            }
        }
        #endregion
 
        #region Telefon (INotifyPropertyChanged Property)
        private string _tele;
        public string Telefon
        {
            get
            {
                return _tele;
            }
            set
            {
                _tele = value;
                RaisePropertyChanged("Telefon");
            }
        }
        #endregion
 
        #region Mobil (INotifyPropertyChanged Property)
        private string _mobil;
        public string Mobil
        {
            get
            {
                return _mobil;
            }
            set
            {
                _mobil = value;
                RaisePropertyChanged("Mobil");
            }
        }
        #endregion
 
        #region Mitarbeiter (INotifyPropertyChanged Property)
        private string _mitarb;
        public string Mitarbeiter
        {
            get
            {
                return _mitarb;
            }
            set
            {
                _mitarb = value;
                RaisePropertyChanged("Mitarbeiter");
            }
        }
        #endregion
 
        #region Bediensprache (INotifyPropertyChanged Property)
        private Int64 _bedienspr;
        public Int64 Bediensprache
        {
            get
            {
                return _bedienspr;
            }
            set
            {
                _bedienspr = value;
                RaisePropertyChanged("Bediensprache");
            }
        }
        #endregion
 
        #region UserROllen
        private ObservableCollection<ViewModel.UserRollen> UserCOll;
        public ObservableCollection<ViewModel.UserRollen> _usercoll
        {
            get
            {
                return UserCOll;
            }
            set
            {
                UserCOll = value;
                RaisePropertyChanged("_usercoll");
            }
        }
        #endregion
        #endregion            
 
        public static ObservableCollection<DBUser> GetUser(Int64 sqlid_i)
        {
            ObservableCollection<DBUser> User = new ObservableCollection<DBUser>();
            ObservableCollection<ViewModel.UserRollen> UserRollenOBJ = new ObservableCollection<ViewModel.UserRollen>();
 
            string pass_s = Klassen.xml.ReadFromXml("Datenbankpass");
            DataTable UserTAB = Klassen.SQLite.Datensatz_EXIST("SELECT * FROM User WHERE id=" + sqlid_i, pass_s);
            try
            {
                foreach (DataRow UserROW in UserTAB.Rows)
                {
                    UserRollenOBJ = ViewModel.UserRollen.GetUserRollen(UserROW.Field<Int64>("id"), UserROW.Field<string>("Mandant"));
                    User.Add(new DBUser(UserROW.Field<Int64>("id"), UserROW.Field<string>("Suchwort"), UserROW.Field<string>("Identnummer"), UserROW.Field<string>("AbasID"), UserROW.Field<string>("Mandant"), UserROW.Field<string>("Username"), UserROW.Field<string>("Passwort"), UserROW.Field<string>("name"), UserROW.Field<Int64>("aktiv"), UserROW.Field<string>("ablaufdatum"), UserROW.Field<string>("email"), UserROW.Field<string>("tele"), UserROW.Field<string>("mtele"), UserROW.Field<string>("Mitarbeiter"), UserROW.Field<Int64>("Bediensprache"), UserRollenOBJ));
                }
            }
            catch
            {
                User = null;
            }
 
            UserTAB.Dispose();
            return User;
        }         
 
        public DBUser()
        {
            this.Suchwort = "";
            this.Identnummer = "";
            this.AbasID = "";
            this.Mandant = "";
            this.Name = "";
            this.Aktiv = 0;
            this.Username = "";
            this.Passwort = "";
            this.Ablaufdatum = "";
            this.Email = "";
            this.Telefon = "";
            this.Mobil = "";
            this.Mitarbeiter = "";
            this.Bediensprache = 0;
            this.UserCOll = new ObservableCollection<ViewModel.UserRollen>();
        }
 
        public DBUser(Int64 id_i, string such_s, string ident_s, string abasid_s, string mand_s, string user_s, string pass_s, string name_s, Int64 aktiv_i, string ablaufd_s, string email_s, string tele_s, string mobil_s, string mitarb_s, Int64 bedienspr_s, ObservableCollection<ViewModel.UserRollen> userrolleOBJ)
        {
            this.Id = id_i;
            this.Suchwort = such_s;
            this.Identnummer = ident_s;
            this.AbasID = abasid_s;
            this.Mandant = mand_s;
            this.Name = name_s;
            this.Aktiv = aktiv_i;
            this.Username = user_s;
            this.Passwort = pass_s;
            this.Ablaufdatum = ablaufd_s;
            this.Email = email_s;
            this.Telefon = tele_s;
            this.Mobil = mobil_s;
            this.Mitarbeiter = mitarb_s;
            this.Bediensprache = bedienspr_s;
            this.UserCOll = userrolleOBJ;
        }
 
        #region INotifyPropertyChanged values
        public event global::System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
 
        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new global::System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
        #endregion
    }
}

Thanks a lot
Best Regards
Rene
0
Kiril Vandov
Telerik team
answered on 24 Jun 2013, 04:51 PM
Hello Rene,

As I looked through the code you provide us I noticed that you are binding your RadGridView to collection called "_usercoll" with elements of type "UserRollen".  You could add the command for adding a new TabItem inside this UserRollen class, but note that you'll need a reference to your MainViewModel so that you could call its AddNewTabItem method.

I hope I was able to help you and if you have further questions please let us know.
 

Kind regards,
Kiril Vandov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
TabControl
Asked by
ITA
Top achievements
Rank 1
Answers by
Kiril Vandov
Telerik team
ITA
Top achievements
Rank 1
Share this question
or