Telerik Forums
UI for WPF Forum
1 answer
237 views

Hi,

I want to load some view in content of pane. The pane is create dynamically to doubleclick on the item's panelbar.

My solution have 2 projects. One for view's and one for model views.

The code from doubleclick is:

private void MenuItemDoubleClick(object sender) {
    UserMenuTab selectedItem = (sender as UserMenuTab);
    string propValueTitlu = selectedItem.Titlu.ToString();
   if (propValueTitlu != null) {
     OuterDockPanes.Add(new RadPane {
       Header = propValueTitlu,
       Content = " ???? I want to put here the view ",
       Tag = "DocumentHost"        
  });
  }
 }

I dont know how cand I upload the solution for better undestanding... 

Thank you.

 

 

Polya
Telerik team
 answered on 27 Feb 2017
4 answers
132 views

Installing the Demos failed

 

Please see att. image

Torben
Top achievements
Rank 2
Iron
 answered on 24 Feb 2017
7 answers
327 views

Hello,

we are using the RadRibbonWindow in our WPF Application. Unfortunately, in the current version (2015.1) of the WPF controls, the RadRibbonWindow has a strange Margin on the right Border when Maximized. Also it seems like, that the content on the left is cut. It feels like the position of the Window is not correct. You can see through to the desktop, even when the Window is maximized.

I tried to override the Template but I couldn't find the Margin causing the problem.

I've also tried to use the new Internal Builds, but it wasn't fixed so far. In the 2014 version of the controls, everything worked fine.

The attached screenshot shows an empty appliction where the bug occures. I've changed my background color to black, so you can see it easily.

Best regards

 

Dinko | Tech Support Engineer
Telerik team
 answered on 24 Feb 2017
2 answers
56 views

Hello. Just on DialogResult, I'm not wrong! I use System.Windows.Forms.FolderBrowserDialog instance in my WPF MVVM application. Please see the following code from the View Model:

. . . . . . . .
using System.Windows.Forms;
. . . . . . . .
FolderBrowserDialog dialog = new FolderBrowserDialog();
DialogResult res = dialog.ShowDialog();
if (res == DialogResult.OK)
{
   this.PathToExcelExportRepository = string.Copy(dialog.SelectedPath);
   this.IsTurnOffExportToExcelSelected = false;
   this.IsTurnOnExportToExcelSelected = true;
   . . . . . . . . .
}

Where IsTurnOffExportToExcelSelected is:

public bool IsTurnOffExportToExcelSelected
{
   get { return this._isTurnOffExportToExcelSelected; }
   set { this.SetProperty(ref this._isTurnOffExportToExcelSelected, value); }
}

and IsTurnOnExportToExcelSelected is:

public bool IsTurnOnExportToExcelSelected
{
   get { return this._isTurnOnExportToExcelSelected; }
   set { this.SetProperty(ref this._isTurnOnExportToExcelSelected, value); }
}

Each one of these properties is binding source fore menu item in the View:

<telerik:RadContextMenu.ContextMenu>
   <telerik:RadContextMenu>
       <telerik:RadMenuItem Header="Turn on export to MS Excel" IsCheckable="True" IsChecked="{Binding IsTurnOnExportToExcelSelected, Mode=TwoWay}"
                                 Command="{Binding TurnOnExportToExcelCommand}"/>
       <telerik:RadMenuItem Header="Turn off export to MS Excel" IsCheckable="True" IsChecked="{Binding IsTurnOffExportToExcelSelected, Mode=TwoWay}"
                                 Command="{Binding TurnOffExportToExcelCommand}"/>
   </telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>

here the source code of TurnOnExportToExcelCommand. It turns on export to CSV-file of the values of real-time chart data-points:

// This line is in the View Model constructor.
this.TurnOnExportToExcelCommand = new DelegateCommand(this.turnOnExportToExcel);
 
// This is the command definition in the View Model.
public DelegateCommand TurnOnExportToExcelCommand { get; private set; }
 
private void turnOnExportToExcel()
{
    FolderBrowserDialog dialog = new FolderBrowserDialog();
    DialogResult res = dialog.ShowDialog();
 
    if (res == DialogResult.OK)
    {
        this.PathToExcelExportRepository = string.Copy(dialog.SelectedPath);
 
        this.IsTurnOffExportToExcelSelected = false;
        this.IsTurnOnExportToExcelSelected = true;
        // Define for which chart (absolute or relative) export to CSV-file is turned on.
        if (this.IsAbsoluteSplineChartSelected || this.IsAbsoluteBarChartSelected)
        {
            // Export of absolute chart data-point to CSV-file:
            Interlocked.CompareExchange(ref this._isAbsoluteChartDataBeingExported, 1, 0);
            Task.Factory.StartNew(this.peekAbsoluteDataForExportToCsv, TaskCreationOptions.LongRunning);
            Task.Factory.StartNew(this.exportToCsvAbsoluteChartPoints, TaskCreationOptions.LongRunning);
            // Export absolute chart data-point values is turned on.
            GlobalStaticMembers.ChartsExportToExcelStatus[0] = true;
        }
        else if (this.IsComparativeSplineChartSelected || this.IsComparativeBarChartSelected)
        {
            // Export of relative chart data-point to CSV-file:
            Interlocked.CompareExchange(ref this._isComparativeChartDataBeingExported, 1, 0);
            Task.Factory.StartNew(this.peekComparativeDataForExportToCsv, TaskCreationOptions.LongRunning);
            Task.Factory.StartNew(this.exportToCsvComparativeChartPoints, TaskCreationOptions.LongRunning);
            // Export relative chart data-point values is turned on.
            GlobalStaticMembers.ChartsExportToExcelStatus[1] = true;
        }
    }
}

The condition of if-statement above is satisfied if DialogResult is DialogResult.OK. I verify it to set breakpoint in debugger. But if I click 'Cancel' button in the dialog then the debugger doesn't not show next steps but IsChecked property of IsTurnOnExportToExcelSelected menu item is set to true (the status of IsChecked property of TurnOffExportToMSExcel menu item is not changed). Why is TurnOnExportToMSExcel boolean property set to true if DialogResult is Cancel?

Polya
Telerik team
 answered on 24 Feb 2017
2 answers
93 views

Is there any way to force the radribbongroup into not center the header horizontally (I want strech)?

Thanks

Inger Marie

Inger Marie
Top achievements
Rank 1
 answered on 24 Feb 2017
1 answer
141 views

Hello,

We are currently using some of your components and we are facing a lot of issues while using RadTreeView. 

Most of them are related to drag/drop operations and the new position of the item in the new TreeView.

As you can see in the video that i attatched everything is working fine until the middle of the video after dragging 5 items to the new TreeView the drag template becomes unstable and blinks, after adding that one to the tree you are not able to keep dragging more items.

The only thing that we modifed is the item template and we are using the latest binaries of UI for WPF.

What we can do?

Thanks

Here you can find the video

https://www.dropbox.com/s/xy6pgw5toynbvpk/dragIssue.mp4?dl=0

 

Dinko | Tech Support Engineer
Telerik team
 answered on 24 Feb 2017
1 answer
228 views

Hi,

I have a fairly simple scenario that I am having trouble with. I have a custom data annotation as shown below. It just makes sure that at least one item in my collection has it's IsSelected flag set.  This collection is bound to an ItemsControl of checkboxes. The xaml is at the bottom. The validation works correctly but the error message displayed in  summary at the bottom if the form is not red and is prefixed with a colon. Is there a way to make this a little better and more consistent with "normal" dataannotation validations so that the ItemsControl or containing stackpanel is highlighted in a similar fashion as a textbox might be highlighted?

Thanks ... Ed

public class HasOneItem : ValidationAttribute
{
    public HasOneItem() {}
 
    protected override ValidationResult IsValid(object value, ValidationContext validationContext)
    {
        if (value != null)
        {
            ObservableCollection<SampleTechniqueInfo> sti = (ObservableCollection<SampleTechniqueInfo>)value;
            if ((from a in sti where a.IsSelected == true select a).Count() == 0)
            {
                var errorMessage = FormatErrorMessage(validationContext.DisplayName);
                return new ValidationResult(errorMessage);
            }
        }
        return ValidationResult.Success;
    }
}
 
 
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="2" Grid.RowSpan ="5">
    <Label Content="Associated Techniques:"  HorizontalAlignment="Left" HorizontalContentAlignment="Left"  Width="350" Height="auto"/>
    <StackPanel Orientation="Vertical" MaxHeight="210" >
        <ItemsControl x:Name ="lstTechniques" ItemsSource="{Binding AssociatedTechniques }"
                        Margin="5,0,0,0"
                        >
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
 
                    <support:UniformGridWithOrientation Orientation="Vertical"  Columns="4"  />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate >
                    <CheckBox Content="{Binding TechniqueAbbr}"
                                IsChecked="{Binding IsSelected, Mode=TwoWay}"
                                ToolTip="{Binding TechniqueName}"
                                      
                        >
 
                    </CheckBox>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
 
    </StackPanel>
</StackPanel>
Yoan
Telerik team
 answered on 24 Feb 2017
1 answer
304 views
I would like to add a checkbox to the headers of columns in a GridView. I tried to replace the textbox defined for the telerik:GridViewDataColumn.Header with a checkbox, but it doesn't respond to clicks. I would like to have text for the header, but also have it respond as a checkbox so that I can "highlight" the specific column for other calculations.
Martin
Telerik team
 answered on 24 Feb 2017
5 answers
566 views

From the drag drop examples on the site, the dragging and dropping within and between grid views is more or less working how we want. But I would like to change the icon in the visual associated with the "effect" and I can't seem to figure out how and where to do it. We have a content template but that only affects the rest of the visual and not the "effect" portion of it.

I tried inheriting from the DragVisual but there are so many overridable things within I can't tell what is needed to be done. One thing however that was particularly interesting, is that when I inherit from the DragVisual but do not override anything within, the "move" icon is gray instead of blue.

I am trying to achieve displaying a delete icon if the user drags an item outside of the grid to indicate that the item will be removed rather than the "no" icon which implies that the action will have no result. Please advise if there is a simpler way to do this.

Stefan Nenchev
Telerik team
 answered on 24 Feb 2017
2 answers
214 views

Hello Telerik,

During a Drag&Drop in a RadTreeView, I encounter some troubles with TreeViewDragDropOptions where the dropped item is positioned. Ideally I would like to get the objects that are positioned before and after (if they exist) the dropped item.

However, following multiple found example (like this one), in my case, the content of TreeViewDragDropOptions is always null.

Those are the objects I am binding to the TreeView:

Node.cs

public class Node<T>
{
   public T Source
   {
      get; set;
   }
 
   public Node<T> Parent
   {
      get; set;
   }
 
   public List<Node<T>> Children = new List<Node<T>>();
}

 

Here T is a Category

Category.cs

public class Category
{
   public string Title
   {
      get; set;
   }
 
   public int Sort
   {
      get; set;
   }
}

 

In the ViewModel, an ObservableCollection contains the hierarchy.

public ObservableCollection<Node<Category>> MyCategories
{
  [...]
}

 

Finally, the Views:

MyView.xaml

<telerik:RadTreeListView Name="CategoriesRadTreeView"
  IsDragDropEnabled="True" telerik:TreeViewSettings.DragDropExecutionMode="New"
  ItemsSource="{Binding MyCategories}"
  AutoGenerateColumns="False">
 
   <telerik:RadTreeListView.ChildTableDefinitions>
      <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" />
   </telerik:RadTreeListView.ChildTableDefinitions>
          
   <telerik:RadTreeListView.SortDescriptors>
      <telerik:SortDescriptor Member="Source.Sort" SortDirection="Ascending" />
   </telerik:RadTreeListView.SortDescriptors>
          
   <telerik:RadTreeListView.Columns>
      <telerik:GridViewDataColumn DataMemberBinding="{Binding Source.Title}" Header="Title" />
      <telerik:GridViewDataColumn DataMemberBinding="{Binding Source.Sort}" Header="Sort" />
   </telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>

 

And the code behind:

MyView.xaml.cs

public WebstoreKatalogView()
{
   InitializeComponent();
 
   DragDropManager.AddDragInitializeHandler(CategoriesRadTreeView, OnDragInitialize);
   DragDropManager.AddDragOverHandler(CategoriesRadTreeView, OnDragOver, true);
   DragDropManager.AddDropHandler(CategoriesRadTreeView, OnDrop);
}
 
private void OnDragInitialize(object sender, DragInitializeEventArgs e)
{
   e.AllowedEffects = DragDropEffects.All;
   var payload = DragDropPayloadManager.GeneratePayload(null);
   var data = ((FrameworkElement)e.OriginalSource).DataContext;
   payload.SetData("DragData", data);
   e.Data = payload;
   e.Handled = true;
}
 
private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
   var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
   if (options != null)
   {
      // never reaches here!
   }
}
 
private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
{
   // this works!
   var node = DragDropPayloadManager.GetDataFromObject(e.Data, "DragData");
}

 

I have no idea what is wrong or what could be missing.

Thank you very much for your help!

 

Sylvain

 

Sylvain
Top achievements
Rank 1
 answered on 24 Feb 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?