Telerik Forums
UI for WPF Forum
1 answer
229 views
I'd like to load an .xslx file for viewing only. In other words I want to stop the user from adding or changing anything. Is there any way I can set read only?
Dinko | Tech Support Engineer
Telerik team
 answered on 17 Jan 2017
3 answers
333 views

There is a small probability issue:

when in a child thread  call the RadWindow.Alert method  to show a message window 

i use Application.Current.Dispatcher.BeginInvoke to call main thread

 Application.Current.Dispatcher.BeginInvoke((Action)delegate
                {
                    RadWindow.Alert(new DialogParameters { Header = StringResources.GetCodeMessage("TiShi"), Content = "error", Owner = Application.Current.MainWindow });
                });

then there is a NullReferenceException  occur

the exception stack is as following

在 Telerik.Windows.Controls.Primitives.TabStripPanel.<>c__DisplayClass14.<MeasureOverride>b__7(UIElement item)
   在 System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   在 System.Linq.Enumerable.Max(IEnumerable`1 source)
   在 System.Linq.Enumerable.Max[TSource](IEnumerable`1 source, Func`2 selector)
   在 Telerik.Windows.Controls.Primitives.TabStripPanel.<>c__DisplayClass14.<MeasureOverride>b__6(Double total, List`1 next)
   在 System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   在 Telerik.Windows.Controls.Primitives.TabStripPanel.MeasureOverride(Size availableSize)
   在 System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   在 System.Windows.UIElement.Measure(Size availableSize)
   在 System.Windows.ContextLayoutManager.UpdateLayout()
   在 System.Windows.UIElement.UpdateLayout()
   在 System.Windows.Interop.HwndSource.SetLayoutSize()
   在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   在 System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   在 System.Windows.Window.SetRootVisual()
   在 System.Windows.Window.SetRootVisualAndUpdateSTC()
   在 System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
   在 System.Windows.Window.CreateSourceWindow(Boolean duringShow)
   在 System.Windows.Window.CreateSourceWindowDuringShow()
   在 System.Windows.Window.SafeCreateWindowDuringShow()
   在 System.Windows.Window.ShowHelper(Object booleanBox)
   在 System.Windows.Window.Show()
   在 System.Windows.Window.ShowDialog()
   在 Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.Open(Boolean isModal)
   在 Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal)
   在 Telerik.Windows.Controls.RadWindow.ShowDialog()
   在 Telerik.Windows.Controls.RadWindow.ConfigureModal(RadAlert content, DialogParameters dialogParams)
   在 Telerik.Windows.Controls.RadWindow.Alert(DialogParameters dialogParameters)
   在 Eurlanda.DataShire.DataShireIDE.MainUserControl.<MainUserControl_Loaded>b__13() 位置 g:\datashire_cloud_IDE\Eurlanda.DataShire.DataShireIDE\MainUserControl.xaml.cs:行号 528
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

I have no idea about this  issue  

Is any solution to avoid?

 

Polya
Telerik team
 answered on 17 Jan 2017
3 answers
69 views

Is it possible to change the way the RadDatePicker behaves when I write numbers ? 

For example I want to write 0101 and Press Enter, the Date should be 01.01.2017 (if the year is not given the current year should be taken). Instead I get 03.01.0101.  Is it possible to reprogram this behavior ?

Devid
Top achievements
Rank 1
 answered on 17 Jan 2017
3 answers
191 views
I am not able to launch the WPF Demos, in my system, i have the SQL'14 express version. but when i start to install the WPF they said to install SQL'08 Express so that i cant install it. they are showing the  below error

component SQL Server 2008 express has failed to install with the following error message" An error occurred attempting to install SQL server 2008 express service pack.1"
The Following COmponenets failed to install
-SQL server 2008 Express/
Kalin
Telerik team
 answered on 17 Jan 2017
4 answers
221 views

Hi,

I'm new in WPF and I would like to know is possible to display in a RadGridView the headers with their details?

I have two DataTable which the first keep the header values and the second Datatable keeps the details values from a database. I'm able to display the header values in the RadGridview but I couldn't find how to display their details for each header.

For Example:

The RadGridView shows the Sales Number, Sales date and total then when the user clicks in the Sales number row it displays the Sales details with all the products and their descriptions.

I would appreciate your help or any suggestions.

Regards,

Oscar

Oscar
Top achievements
Rank 1
 answered on 16 Jan 2017
7 answers
265 views

Hello Telerik,

 

In my char, i'm using Cartesian & Bar Series. For the BarSeries, I'm using a "Custom Rectangle". My code :

BarSeries seriePluvio = new BarSeries();
 
//set attributs...
//....
//-------------
 
//Create a template for for custom bar
DataTemplate dt1 = new DataTemplate { DataType = typeof(System.Windows.Shapes.Rectangle) };
FrameworkElementFactory dt1Factory = new FrameworkElementFactory { Type = typeof(System.Windows.Shapes.Rectangle) };
 
//Set color for the bar --> IS OK
dt1Factory.SetValue(System.Windows.Shapes.Rectangle.FillProperty, new SolidColorBrush(param.CouleurMesuresValides));
 
//Set the width of the bar --> IS OK
double d = new double();
d = (Convert.ToDouble(param.EpaisseurTraitMesuresValides));
dt1Factory.SetValue(System.Windows.Shapes.Rectangle.WidthProperty, d);
 
//Set the line style of the bar --> IS NOK
dt1Factory.SetValue(System.Windows.Shapes.Rectangle.StrokeDashArrayProperty, new DoubleCollection { 2, 2, 2, 2 });
 
//The end of the code...
dt1.VisualTree = dt1Factory;
seriePluvio.PointTemplates.Add(dt1);
//...............

 

So, my problem is that the LineStyle is not applied. I tried with differents values/parameters for the DoubleCollection but this is always the same result. No visual changement.

 

I'm using StrokeDashArrayProperty because this is the used property for the CartesianSeries.

Can you help me ?

 

Thank you very much !

Tanya
Telerik team
 answered on 16 Jan 2017
4 answers
623 views

Hi,

I have all my code working great except for this one thing. When I add an item to the bound collection of the gridview my rowdetails template displays and all is well except that the + does not toggle to a -. How do I change this via code? I tried doing it in the OnCollectionChanged event (for the Add action) by setting the IsExpanded flag,  but when I try to do a GetRowForItem, it returns null. If I try to find the selected item via MyGrid.ChildrenOfType<GridViewRow>(), ALL the items are null.

Help!!!

Thanks ... Ed

Randy Hompesch
Top achievements
Rank 1
 answered on 16 Jan 2017
5 answers
213 views

I am evaluating radpdfviewer and seeing Telerik.Windows.Documents.Core.Shapes instances ( Line Segment,Path Segment) are not cleaned up when taking memory snapshot in profiling app which invokes garbage collector. I am wondering why?

I initialize pdfviewer to read file on demand and use while loop to cycle through pages

 

pdfViewer.GoToPage(page) in a loop

when rerach last page I make page=1 and cycle again

 

 

Thanks

 

Deyan
Telerik team
 answered on 16 Jan 2017
1 answer
360 views

Hello,

I am doing a RadGridView, with data from a LiteDB with MVVM to refuel. This works so far quite well. Now you want to use a buttonbar to edit the data.

<Button Grid.Column = "0"
      Margin = "0,0,3,0"
      Command = "telerik:RadGridViewCommands.Delete"
      CommandTarget = "{Binding ElementName=GridShutdowns}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width = "Auto" />
      <ColumnDefinition Width = "10" />
      <ColumnDefinition Width = "*" />
    </Grid.ColumnDefinitions>
    <fa:FontAwesome Icon = "Trash" VerticalAlignment = "Center" HorizontalAlignment = "Center" />
    <TextBlock Grid.Column = "2" VerticalAlignment = "Center" HorizontalAlignment = "Center" Text = "Delete" />
  </Grid>
</Button>
<Button Grid.Column = "1"
      Margin = "0,0,3,0"
      Command = "telerik:RadGridViewCommands.BeginInsert"
      CommandTarget = "{Binding ElementName=GridShutdowns}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width = "Auto" />
      <ColumnDefinition Width = "10" />
      <ColumnDefinition Width = "*" />
    </Grid.ColumnDefinitions>
    <fa:FontAwesome Icon = "PlusCircle" VerticalAlignment = "Center" HorizontalAlignment = "Center" />
    <TextBlock Grid.Column = "2" VerticalAlignment = "Center" HorizontalAlignment = "Center" Text = "Insert" />
  </Grid>
 
</Button>
<Button Grid.Column = "2"
      Margin = "0,0,3,0"
      Command = "telerik:RadGridViewCommands.CommitEdit"
      CommandTarget = "{Binding ElementName=GridShutdowns}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width = "Auto" />
      <ColumnDefinition Width = "10" />
      <ColumnDefinition Width = "*" />
    </Grid.ColumnDefinitions>
    <fa:FontAwesome Icon = "Save" VerticalAlignment = "Center" HorizontalAlignment = "Center" />
    <TextBlock Grid.Column = "2" VerticalAlignment = "Center" HorizontalAlignment = "Center" Text = "Save" />
  </Grid>
 
</Button>
<Button Grid.Column = "3"
      Margin = "0,0,3,0"
      Command = "telerik:RadGridViewCommands.CancelRowEdit"
      CommandTarget = "{Binding ElementName=GridShutdowns}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width = "Auto" />
      <ColumnDefinition Width = "10" />
      <ColumnDefinition Width = "*" />
    </Grid.ColumnDefinitions>
    <fa:FontAwesome Icon = "Ban" VerticalAlignment = "Center" HorizontalAlignment = "Center" />
    <TextBlock Grid.Column = "2" VerticalAlignment = "Center" HorizontalAlignment = "Center" Text = "Cancel" />
  </Grid>
 
</Button>

 

I use how to see the Comands: RadGridViewCommands.CancelRowEdit, etc. (ShutdownViewModel.cs)

/// <summary>
/// Constructor
/// </summary>
public ShutdownViewModel()
{
  try
  {
    MakeSampleData();
    InitializeCommands();
  }
  catch (Exception exc)
  {
    Log.Error(exc);
  }
}
 
/// <summary>
/// </summary>
private void InitializeCommands()
{
  ICommand deleteCommand = RadGridViewCommands.Delete;
  ICommand saveCommand = RadGridViewCommands.CommitEdit;
 
  //todo: ???
}
 
private void MakeSampleData()
{
  using (var db = new LiteDatabase(FileAndPath.DataBaseFile))
  {
    var ShutdownSources = db.GetCollection<Shutdown>("Shutdowns");
    IEnumerable<Shutdown> shutdownSources = ShutdownSources.FindAll().OrderBy(x => x.Weekday).ThenBy(x => x.ShutdownTime.TimeOfDay);
    if (shutdownSources != null && shutdownSources.Any())
    {
      _shutdowns = new ObservableCollection<Shutdown>(shutdownSources);
    }
    else
    {
      _shutdowns = new ObservableCollection<Shutdown>()
      {
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 0},
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 1},
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 2},
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 3},
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 4},
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 5},
        new Shutdown() {ShutdownId = Guid.NewGuid(), Weekday = 6},
      };
 
      var col = db.GetCollection<Shutdown>("Shutdowns");
      foreach (Shutdown shutdown in _shutdowns)
      {
        col.Insert(shutdown);
        IndexObject(col);
      }
    }
  }
}

 

After InitializeCommands I ask myself the question where I process now actually "saveCommand" and how?

Is that correct?

/// <summary>
/// SelectedItem
/// </summary>
public Shutdown SelectedShutdown
{
  get { return _selectedShutdown; }
  set
  {
    if (_selectedShutdown != value)
    {
      _selectedShutdown = value;
      OnPropertyChanged(nameof(SelectedShutdown));
    }
  }
}
 
/// <summary>
/// </summary>
private void InitializeCommands()
{
  ICommand deleteCommand = RadGridViewCommands.Delete;
  ICommand saveCommand = RadGridViewCommands.CommitEdit;
 
  //todo: ???
 
  saveCommand.Execute(SaveShutdown());
}
 
private object SaveShutdown()
{
  try
  {
    if (SelectedShutdown != null)
    {
      using (var db = new LiteDatabase(FileAndPath.DataBaseFile))
      {
        //todo: save/update Shutdown for DB
      }
    }
  }
  catch (Exception exc)
  {
    Log.Error(exc);
  }
  return null;
}

 

How do I use the RadGridViewCommands to edit data in the DB?

Thanks for your help

 

 

 

 

 

 

Dilyan Traykov
Telerik team
 answered on 16 Jan 2017
1 answer
103 views

 

I have two controls in a GridViewDataColumn (LinkButton and Texblock) and only one control is visible at a time.

 

<Controls:GridViewDataColumn DataMemberBinding="{Binding Id, Mode=OneWay}"
                                  Header="{x:Static lr:TransactionHistoryRes.Id_Header_Text}"
                                  UniqueName="TransactionHistoryModelId" Width="130">
                         <Controls:GridViewDataColumn.CellTemplate>
                           <DataTemplate>
                             <Grid>
                               <max:LinkButton HorizontalAlignment="Right"
                                       Command="{Binding DataContext.OpenDocumentCommand, RelativeSource={RelativeSource FindAncestor, AncestorType=Views:TransactionHistoryView}}"
                                       CommandParameter="{Binding Path=.}"
                                       Content="{Binding Path=Id}"
                                       Visibility="{Binding Path=CanCreateOrViewDocument, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
                               </max:LinkButton>
 
                               <TextBlock HorizontalAlignment="Right"
                                          Text="{Binding Path=Id}"
                                          ToolTip="{Binding Path=Information}"
                                          Visibility="{Binding Path=CanCreateOrViewDocument, Converter={StaticResource ReverseBooleanToVisibilityCollapsedConverter}}"/>
                             </Grid>
                           </DataTemplate>
                         </Controls:GridViewDataColumn.CellTemplate>
                       </Controls:GridViewDataColumn>

 

When the grid initially load, it works fine. 

However, there's a wierd behavior that if you SORT the column, initially - the LinkButtons wont show even if it's visibility = true

When you try to sort the column again, the LinkButtons are shown "gradually". (see video link below)

https://youtu.be/GI5G-WaPy-k

When I tried to remove the <Texblock> and just retain the LinkButton, its not behaving like this so I think its something about putting two controls in the cell template. I tried separating the two controls by stackpanel but sill the same behaviour.

 

Thanks,
Karlo

 

Stefan Nenchev
Telerik team
 answered on 13 Jan 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?