Biniding IsHidden property does not work

I set  thie in xaml 

<syncfusion:GridNumericColumn HeaderText="SCONTO 2" MappingName="Sconto2" NumberDecimalDigits="2" TextAlignment="End" Width="70" IsHidden="{Binding Path = HideDisocunt}"/>

and this in my vielmodel

 if(GlobalResources.Current.Setting.Sconti.Contains("2"))
            {
                HideDisocunt = false;
            }
            else
            {
                HideDisocunt = true;
            }

the proeprty is public as follow


  private Boolean _HideDisocunt;
        public Boolean HideDisocunt
        {
            get { return _HideDisocunt; }
            set
            {
                SetProperty(ref _HideDisocunt, value);
            }
        }


3 Replies

JA Jayaraman Ayyanar Syncfusion Team March 7, 2018 11:24 AM UTC

Hi Alberto, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query with the provided XAML settings. It is working fine in our side.  
 
Note: The IsHidden  property may not work if we failed to give the source in the binding.  
 
Refer the below code example for more details.  
 
ViewModel logics: 
  
  
public bool IsHidden { get; set; }  
  
private ObservableCollection<OrderInfo> orderInfo;  
public ObservableCollection<OrderInfo> OrderInfoCollection  
{  
    get { return orderInfo; }  
    set { this.orderInfo = value; }  
}  
  
public OrderInfoRepository()  
{  
    IsHidden = true;  
    orderInfo = new ObservableCollection<OrderInfo>();  
    this.GenerateOrders();       
}  
  
  
  
Code logics for Xaml: 
 
  
<sfgrid:SfDataGrid x:Name="dataGrid" AutoGenerateColumns="False"  
                           ColumnSizer="Auto" AllowEditing="True" 
                           ItemsSource="{Binding OrderInfoCollection}"> 
 
            <sfgrid:SfDataGrid.Columns> 
                <sfgrid:GridNumericColumn MappingName="OrderID" NumberDecimalDigits="2" TextAlignment="End" Width="70" HeaderText="Order ID"  IsHidden="{Binding IsHidden,Source={x:Reference viewModel}}" /> 
                <sfgrid:GridTextColumn MappingName="CustomerID" HeaderText="Customer ID"/> 
                <sfgrid:GridTextColumn MappingName="Customer" HeaderText="Customer" /> 
                <sfgrid:GridTextColumn MappingName="ShipCountry" HeaderText="Ship Country" /> 
                <sfgrid:GridTextColumn MappingName="ShipCity" HeaderText="Ship City"/> 
            </sfgrid:SfDataGrid.Columns> 
        </sfgrid:SfDataGrid>  
  
We have also prepared a sample based on the above code examples and you can download the same from below link.  
 
 
Regards,  
Jayaraman. 



AL Alberto March 7, 2018 03:42 PM UTC

Thanks jayaraman i will download the example in order to see how does it work.

Alberto C.


JA Jayaraman Ayyanar Syncfusion Team March 8, 2018 06:55 AM UTC

Hi Alberto,  
 
Thanks for the update. Please let us know if you require any further assistance.  
 
Regards, 
Jayaraman. 


Loader.
Up arrow icon